NSURL 任何时候都不起作用

发布于 2024-08-25 03:20:47 字数 278 浏览 3 评论 0原文

我遇到以下问题,有时我的 openURL-Dialog 工作得很好,然后我查看了 url 中的变量,这就是变量:

www.brehm-gmbh.de

但有时变量末尾有一些疯狂的元素,如下所示:

www.adamczyk-fenster.de%E2%80%8E

我得到此页面来自 .asc 文件,并且在没有此元素的情况下,两者都在此文件中正常, 我能做什么来解决这个问题?

谢谢大家事先的帮助

i have the following problem sometimes my openURL-Dialog works perfectly, then i looked at the variable from the url and that is the variable:

www.brehm-gmbh.de

but some other times there are some crazy elements at the end of the variable like this:

www.adamczyk-fenster.de%E2%80%8E

i get this pages from an .asc file and both are in this file normal without this elements,
what can i do to solve this problem?

thank you all for helping beforehand

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

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

发布评论

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

评论(1

不爱素颜 2024-09-01 03:20:47

来自维基百科:

从左到右标记 (LRM) 是
控制字符或非打印
字符,用于计算机化
双向文本的排版,
包含混合从左到右的脚本
(例如英语和俄语)和
从右到左的文字(例如阿拉伯语
和希伯来语)。它用于改变
相邻字符的分组方式
关于文本方向。

您收到此消息是因为 (1) 您有非英语 URL,正在从非英语字符串组成 URL,或者您有一些其他非英语元素,并且字符串编码正在尝试补偿,或者 (2) 它是垃圾解释为编码(如果一致则不太可能。)

在使用字符串之前调用 -[NSString localizedNameOfStringEncoding] 查看它正在使用的编码。在将字符串放入 NSURL 之前读取字符串时,您可能需要显式建立编码。

From Wikipedia:

The left-to-right mark (LRM) is a
control character or non-printing
character, used in the computerized
typesetting of bi-directional text,
containing mixed left-to-right scripts
(such as English and Russian) and
right-to-left scripts (such as Arabic
and Hebrew). It is used to change the
way adjacent characters are grouped
with respect to text direction.

You're getting this because (1) you've got non-English URLs, are composing URLs from non-English strings or you have some other non-English elements and the string encoding is attempting to compensate or (2) it's garbarge being interpreted as an encoding (unlikely if it is consistant.)

Call -[NSString localizedNameOfStringEncoding] on the string before you use it see what encoding it is using. You probably need to explicitly establish an encoding when you read in the strings before you put them in the NSURL.

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