带有泰语的 NSURL

发布于 2024-08-17 01:52:22 字数 286 浏览 6 评论 0原文

例如,我对 NSURL 和泰国语言有疑问 “http://www. xyp.com?var=ไทย" 它不起作用,但如果你使用 “http://www.xyp.com?var=Thai" 没关系。我不知道如何解决这个问题,请任何人帮助我。

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.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

戒ㄋ 2024-08-24 01:52:22

我在 URL 字符串上使用了 stringByAddingPercentEscapesUsingEncoding 方法,它解决了问题,我使用的是丹麦字符

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

阳光的暖冬 2024-08-24 01:52:22

问题实际上出在 URI 的定义上。 RFC3986 将 URI 的内容以及扩展后的 URL 定义为 ASCII 字符,因此你必须以某种方式对它们进行编码。这就是百分比编码的全部内容。问题是没有人就编码哪些字节达成一致。 有些人更喜欢获取原始内容,将其转换为 UTF- 8,然后使用标准百分比编码对字节进行编码。其他人会简单地直接编码 UCS-2 字节,但你会遇到字节顺序问题。

您可能还想阅读 UNICODE URL 解码 帖子。

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.

十雾 2024-08-24 01:52:22

NSURL 要求对所有特殊字符进行转义。

NSURL requires that all special characters be escaped.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文