Re: NSString converted into unicode
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