• 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
Re: Converting ASCII to UTF-8?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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 initWithData: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.


References: 
 >Converting ASCII to UTF-8? (From: "Huyler, Christopher M" <email@hidden>)

  • Prev by Date: NSTextFieldCell with scrollers
  • Next by Date: Re: Converting ASCII to UTF-8?
  • Previous by thread: Converting ASCII to UTF-8?
  • Next by thread: Re: Converting ASCII to UTF-8?
  • Index(es):
    • Date
    • Thread