• 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: NSString converted into unicode
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: NSString converted into unicode


  • Subject: Re: NSString converted into unicode
  • From: j o a r <email@hidden>
  • Date: Sun, 12 Nov 2006 16:22:28 +0100

Hej,

On 12 nov 2006, at 11.13, Carl Johan Foss wrote:

I was wondering if anybody can give me a hint on how to convert an
NSString which contains å ä ö characters into a unicode string

Just for the record, the internal representation of NSString is Unicode, so no conversion is required if that's all that you need. You can actually consider an NSString to be "without encoding", as the encoding is only really interesting when import / export characters from / to APIs that doesn't accept NS/CFStrings.


In this case what you really want to do is to create a representation that is valid for a URL, according to RFC 2396. When you think about it, it's actually a bit weird that NSURL doesn't provide this type of functionality as an option when creating instances from NSStrings. It seems that something like this would make sense:

+[NSURL URLWithString:(NSString *) string encoding:(NSStringEncoding) encoding]

The current way to create an NSURL from an NSString - sometimes requiring you to create an intermediary NSString with pre-converted characters - seems a bit backward. I've filed a case with Apple about that.


On 12 nov 2006, at 11.28, Dmitry Savenok wrote:

try CFURLCreateStringByAddingPercentEscapes

There is also:

-[NSString stringByAddingPercentEscapesUsingEncoding: (NSStringEncoding)encoding]


j o a r


Attachment: smime.p7s
Description: S/MIME cryptographic signature

 _______________________________________________
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: NSString converted into unicode
      • From: Carl Johan Foss <email@hidden>
References: 
 >NSString converted into unicode (From: "Carl Johan Foss" <email@hidden>)
 >Re: NSString converted into unicode (From: "Dmitry Savenok" <email@hidden>)

  • Prev by Date: Re: MyDocument instance variables, dealloc problems
  • Next by Date: Re: launchd agents
  • Previous by thread: Re: NSString converted into unicode
  • Next by thread: Re: NSString converted into unicode
  • Index(es):
    • Date
    • Thread