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

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


  • Subject: Unicode in URLs (was "Handling framework exceptions/errors?")
  • From: David Troy <email@hidden>
  • Date: Sun, 29 Jun 2008 16:10:24 -0400

Jens,

Thanks for the help.

I am being handed a URL as an NSString and am simply forwarding it to the frameworks for processing.

A example URL which causes a crash is:
http://foo.com/56033713/アイコン用ハング音_normal.jpg

(where foo.com is something else)

I didn't check to see if [NSURL URLWithString:url] is returning nil. If it is, I should of course be trapping that and not trying to create a request from it.

I am doing this:
NSMutableURLRequest *theRequest=[NSMutableURLRequest requestWithURL: [NSURL URLWithString:url]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:timeout];


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: ?

Thanks!

Dave


On Jun 29, 2008, at 4:00 PM, Jens Alfke wrote:


On 29 Jun '08, at 9:56 AM, David Troy wrote:

I have a situation where I am loading arbitray data from network- supplied URLs. Sometimes the URLs contain Kanji unicode characters. When they do, my HTTP loading mechanism (which is built around NSURL* frameworks) dies with an exception deep inside of CFURLGetString.

That indicates either a bug in the frameworks, or that you're passing in illegal values.


Also, what do you mean by a URL containing Kanji characters? URLs can only contain ASCII; anything else should be escaped using "%". If you try to construct an NSURL from an invalid string, you'll get nil, and passing that nil URL into other framework calls could definitely cause exceptions/crashes.

Pasting in the backtrace from a crash log would be useful for diagnosing this.

—Jens

_______________________________________________

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


  • Follow-Ups:
    • Re: Unicode in URLs (was "Handling framework exceptions/errors?")
      • From: "Stephen J. Butler" <email@hidden>
References: 
 >Handling framework exceptions/errors? (From: David Troy <email@hidden>)
 >Re: Handling framework exceptions/errors? (From: Jens Alfke <email@hidden>)

  • Prev by Date: Re: Handling framework exceptions/errors?
  • Next by Date: Re: Handling framework exceptions/errors?
  • Previous by thread: Re: Handling framework exceptions/errors?
  • Next by thread: Re: Unicode in URLs (was "Handling framework exceptions/errors?")
  • Index(es):
    • Date
    • Thread