Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

idelovski

macrumors regular
Original poster
Sep 11, 2008
235
0
In Carbon,

using some code that deals with fonts I got "Osaka\x81\x7c\x93\x99\x95\x9d" as a font name. Is there some document describing such names and how to properly use them? Should I filter them out and how?

For example, I had trouble converting it to CFString. CFStringCreateWithBytes() returns NULL when I pass that name.

Googling around didn't help too much, although there are few sightings of "Osaka\x81\x7c\x93\x99\x95\x9d" string on the web.
 

kainjow

Moderator emeritus
Jun 15, 2000
7,958
7
Looks like you're not dealing with a unicode string properly. Can you post some code?
 

Littleodie914

macrumors 68000
Jun 9, 2004
1,813
8
Rochester, NY
Yea you're definitely getting some hexadecimal code chunked on the end there. I wish I had more information for you, but without seeing what you're trying to do, I think that's all we can conclude! :)
 

idelovski

macrumors regular
Original poster
Sep 11, 2008
235
0
I think I got it.

Code:
char * fontName = "Osaka\x81\x7c\x93\x99\x95\x9d";
int    strLen = strlen (fontName);

This returns NULL:
cfStr = CFStringCreateWithBytes (NULL, (const UInt8 *) fontName, strLen, kTextEncodingWindowsLatin2, FALSE);

And this returns a proper CFString:
cfStr = CFStringCreateWithBytes (NULL, (const UInt8 *) fontName, strLen, kTextEncodingISOLatin2, FALSE);

I'm on Tiger.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.