1

I have problem with NSURL and Thailand language for example "http://www.xyp.com?var=ไทย" it does't work but if you use "http://www.xyp.com?var=Thai" it ok. I don't know how to solve this problem anyone please help me.

hippietrail
  • 15,848
  • 18
  • 99
  • 158
mr.octobor
  • 191
  • 2
  • 4
  • 18
  • possible duplicate of [URLWithString: returns nil](http://stackoverflow.com/questions/1981390/urlwithstring-returns-nil) – Mike Abdullah Apr 14 '13 at 18:01

3 Answers3

5

i used the method stringByAddingPercentEscapesUsingEncoding on the URL string, and it solved the problem, i was using Danish Characters

RVN
  • 4,157
  • 5
  • 32
  • 35
1

The problem is actually with the definition of a URI. RFC3986 defines the contents of a URI and, by extension, a URL as ASCII characters so you have to encode them somehow. This is what Percent encoding is all about. The problem is that no one agrees on what bytes to encode. Some people prefer to take the raw content, convert it into UTF-8, and then encode the bytes using standard percent encoding. Others will simply encode the UCS-2 bytes directly but then you have Byte order problems.

You might want to read the UNICODE URL Decoding posting as well.

Community
  • 1
  • 1
D.Shawley
  • 58,213
  • 10
  • 98
  • 113
0

NSURL requires that all special characters be escaped.

Azeem.Butt
  • 5,855
  • 1
  • 26
  • 22