• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Problem solved: Dealing with non-standard character sets...
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Problem solved: Dealing with non-standard character sets...


  • Subject: Problem solved: Dealing with non-standard character sets...
  • From: Michael Heinz <email@hidden>
  • Date: Sat, 8 Oct 2005 11:46:35 -0400

Well, that turned out to be a lot easier than I thought (although I'm a little worried about buffer over runs). I'm also weirded out by how unichar doesn't seem to be defined or discussed anywhere in the documentation and doesn't seem to be a built-in type either (at least, XCode doesn't treat the word "unichar" the same way it does "unsigned char").

For anyone curious the final code is below. It's not exactly high performance, but it works. I solved the "what font" issue by setting the font of the NS* objects in question to Apple Symbol.

Thank you to everyone who helped me out.

-----------

static unsigned short uniCharMap[256] = {
    0xffff,
    0xffff,
    ......
    0x25a6,
    .....
    0x2193,
    ... etc., etc.,
)

....

+ (NSString *)convertStringtoUnicode: (const unsigned char *)string
{
    NSMutableString *uniString = [[NSMutableString alloc] init];
    int i;

for (i=0;string[i];i++) {
unichar c = string[i];
unichar uc = uniCharMap[c];
if (uc == 0xffff) {
[uniString appendString: [NSString stringWithCharacters:&c length:1]];
} else {
[uniString appendString: [NSString stringWithCharacters:&uc length:1]];
}
}
return uniString;
}



_______________________________________________ Do not post admin requests to the list. They will be ignored. Cocoa-dev mailing list (email@hidden) Help/Unsubscribe/Update your Subscription: This email sent to email@hidden
References: 
 >Dealing with non-standard character sets... (From: Michael Heinz <email@hidden>)
 >Re: Dealing with non-standard character sets... (From: Ricky Sharp <email@hidden>)
 >Re: Dealing with non-standard character sets... (From: Michael Heinz <email@hidden>)
 >Re: Dealing with non-standard character sets... (From: Douglas Davidson <email@hidden>)
 >Re: Dealing with non-standard character sets... (From: Andy Armstrong <email@hidden>)
 >Re: Dealing with non-standard character sets... (From: Douglas Davidson <email@hidden>)
 >Re: Dealing with non-standard character sets... (From: Michael Heinz <email@hidden>)
 >Re: Dealing with non-standard character sets... (From: Andy Armstrong <email@hidden>)

  • Prev by Date: Re: restricting input to text field
  • Next by Date: Re: NSSliderCell Drawing Issue
  • Previous by thread: Re: Dealing with non-standard character sets...
  • Next by thread: Re: Hiding the disclosure triangle in NSOutlineView
  • Index(es):
    • Date
    • Thread