Re: NSString looses Umlaute
Re: NSString looses Umlaute
- Subject: Re: NSString looses Umlaute
- From: Ben Kennedy <email@hidden>
- Date: Wed, 21 Dec 2011 17:18:44 -0800
On 21 Dec 2011, at 4:45 pm, Alexander Reichstadt wrote:
> NSString *theContent = [[NSString alloc] initWithData:theData encoding:NSASCIIStringEncoding];
> theContent = [[theContent componentsSeparatedByString:@"\r"] objectAtIndex:1];
> theContent = [theContent stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding];
> theContent = [theContent stringByReplacingPercentEscapesUsingEncoding:NSUTF8StringEncoding];
Is this really your code? What is the purpose of the latter two lines? They are completely reciprocal (i.e. redundant).
> I can even see it handles everything correctly in NSLog, first I see the unicode for an Umlaut, then it converts it to the correct percent value, like like รถ to 94, but when the final NSString is printed to an NSControl, the Umlaute are missing or garbled.
>
> The original file is ascii-encoded.
Impossible. ASCII does not represent any characters with diacritical marks. Perhaps the original file is ISO-Latin-1 encoded. You could try using NSISOLatin1StringEncoding.
b
--
Ben Kennedy, chief magician
Zygoat Creative Technical Services
http://www.zygoat.ca
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden