• 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: [newbie] Cocoa UI and UTF-8
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [newbie] Cocoa UI and UTF-8


  • Subject: Re: [newbie] Cocoa UI and UTF-8
  • From: Prachi Gauriar <email@hidden>
  • Date: Tue, 12 Jul 2005 08:46:30 -0400


On Jul 12, 2005, at 6:55 AM, Yvon Thoraval wrote:
Le 12 juil. 05 à 12:06, j o a r a écrit :
It's incorrect to attempt to create constant ObjC strings out of anything that's not 7-bit ASCII (see ObjC PDF). You can find a lot more in the list archives. This is my favorite:

<http://www.cocoabuilder.com/archive/message/cocoa/2005/3/30/131791>

i don't agree with the above mentionned because saying "it isn't safe to include utf-8 characters in source code" because modern editors are able to take into account file's encoding.

What joar is saying is that you can't use any characters outside of 7- bit ASCII for constant NSStrings. This is because the class used for constant NSStrings (NSConstantString) does not support those characters. You can use UTF-8 in your source code most the time without any trouble, but you'll certainly run into problems if you attempt to write a constant NSString with non-ASCII characters.


cause i know that, doing a transcoding from MacOS Roman to UTF-8 i get utf-8 right chars. (verified manually with an hex editor or indirectly by the fact standard xml parser are satisfied)

strings are always tied to a given encoding, even us-ascii is an encoding.

NSStrings use Unicode internally, so as long as you specify the correct encoding when you create strings from buffer data, you should be fine. For an example of how to switch between multiple text encodings (for opening/saving), check out the TextEdit example at / Developer/Examples/AppKit/TextEdit/.


-Prachi
_______________________________________________
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


  • Follow-Ups:
    • Re: [newbie] Cocoa UI and UTF-8
      • From: Yvon Thoraval <email@hidden>
References: 
 >[newbie] Cocoa UI and UTF-8 (From: Yvon Thoraval <email@hidden>)
 >Re: [newbie] Cocoa UI and UTF-8 (From: John Stiles <email@hidden>)
 >Re: [newbie] Cocoa UI and UTF-8 (From: Yvon Thoraval <email@hidden>)
 >Re: [newbie] Cocoa UI and UTF-8 (From: j o a r <email@hidden>)
 >Re: [newbie] Cocoa UI and UTF-8 (From: Yvon Thoraval <email@hidden>)

  • Prev by Date: Re: [newbie] Cocoa UI and UTF-8
  • Next by Date: Re: Apple system icons: guidelines for use in Cocoa applications?
  • Previous by thread: Re: [newbie] Cocoa UI and UTF-8
  • Next by thread: Re: [newbie] Cocoa UI and UTF-8
  • Index(es):
    • Date
    • Thread