On 8 Sep 2007, at 5:17 PM, Adam R. Maxwell wrote:

>
> On Sep 8, 2007, at 03:47, Christiaan Hofman wrote:
>
>> What is the best procedure to transform an octal or hexadecimal code
>> (as in \ddd or A3) interpreted in a given encoding (which may not be
>> UTF-8) into a character to be added to an NSString?
>
> You can parse those (the hex/octal strings) as ASCII, right?  Since
> those are just integers (chars), add each one to an NSData, then
> intepret that as some encoding.  Maybe I've misunderstood the problem,
> though.
>

The parsing is no problem, that's just an NSScanner. I've now used - 
[NSString initWithBytes:length:encoding:]. It should be alright with  
the size, as the octal is at most 3 characters (excluding the "\")  
and the hex is 2 characters long. It's in the new SKFDFParser object.

>> If it were UTF-8
>> I could simply parse the code, create a number, and use the %C format
>> specifier. But what do I do for other encodings?
>
> I'd be wary of that...isn't %C an Apple extension for a 16 bit
> unichar, whereas a UTF-8 character might be up to 4 bytes?  This stuff
> gets pretty confusing.
>
> Adam
>

I never know ;-/

Christiaan


-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2005.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
skim-app-develop mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/skim-app-develop

Reply via email to