• 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: Unicode in URLs (was "Handling framework exceptions/errors?")
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Unicode in URLs (was "Handling framework exceptions/errors?")


  • Subject: Re: Unicode in URLs (was "Handling framework exceptions/errors?")
  • From: "Stephen J. Butler" <email@hidden>
  • Date: Sun, 29 Jun 2008 16:42:46 -0500

On Sun, Jun 29, 2008 at 3:10 PM, David Troy <email@hidden> 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 (email@hidden)

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:

This email sent to email@hidden

References: 
 >Handling framework exceptions/errors? (From: David Troy <email@hidden>)
 >Re: Handling framework exceptions/errors? (From: Jens Alfke <email@hidden>)
 >Unicode in URLs (was "Handling framework exceptions/errors?") (From: David Troy <email@hidden>)

  • Prev by Date: viewing method calls
  • Next by Date: Re: NSTextView to replace NSTextList confused
  • Previous by thread: Unicode in URLs (was "Handling framework exceptions/errors?")
  • Next by thread: Re: Handling framework exceptions/errors?
  • Index(es):
    • Date
    • Thread