Re: Converting ASCII to UTF-8?
Re: Converting ASCII to UTF-8?
- Subject: Re: Converting ASCII to UTF-8?
- From: Ondra Cada <email@hidden>
- Date: Tue, 30 Mar 2004 02:39:42 +0200
Christopher,
On Monday, Mar 29, 2004, at 23:57 Europe/Prague, Huyler, Christopher M
wrote:
If I read an ASCII string in from a file and store it in an NSString,
how could I convert it to UTF-8 so it will display properly?
Well, you don't need to: ASCII is a (special case of) UTF8, and if it
does not display properly, there's another (unrelated) bug somewhere.
Perhaps you meant a specific encoding of those non-ASCII characters,
like ISO-Latin-1, those windoze "code pages", and so on? If so, just
use the standard initWith
Data:encoding: with an appropriate encoding
method to create the string; all the Cocoa GUI objects would display it
correctly, no need to bother with UTF8. Nevertheless, if you need an
extra output in UTF8, just use dataWithEncoding:allowLossyConversion:
with NSUTF8StringEncoding.
---
Ondra Hada
OCSoftware: email@hidden
http://www.ocs.cz
private email@hidden
http://www.ocs.cz/oc
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.