On Sun, Jun 29, 2008 at 3:10 PM, David Troy <[EMAIL PROTECTED]> wrote:
> I was sort of under the impression that NSURL URLWithString: would deal with
> escaping/translating the Kanji characters, but I could see how it might not.
>
> Is there some method I can use to break the Kanji back out into escaped
> characters before passing it to NSURL URLWithString: ?

The problem is that NSURL doesn't know what encoding scheme to use
when escaping the kanji. Most modern applications expect UTF-8, but
it's possible you need Japanese EUC or Shift_JIS. When you know what
encoding you want to use, pass the string through -[NSString
stringByAddingPercentEscapesUsingEncoding:].

But as someone else hinted, this doesn't fix japanese domain names.
There is, unfortunately, no built in support for punycode, and
-[NSString stringByAddingPercentEscapesUsingEncoding:] will completely
mug your hostname. In this case, you need a more complex scheme to
handle URL strings. Probably break apart the URL into its pieces,
encode the hostname and path separately, and then put it back together
with -[NSURL initWithScheme:host:path:].
_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [EMAIL PROTECTED]

Reply via email to