Java 两个 URL 编码字符串之间的差异
下面两个编码字符串有什么区别?
%D0%9E%D0%BA%D0%B6%D1%8D%D0%B7
我
%26%231055%3B%26%231088%3B%26%231080%3B%26%231074%3B%26%231077%3B%26%231090%3B
正在尝试将俄语文本“Привет”进行 URL 编码到上面的第二个编码字符串中(W3Schools 编码器 正确执行),但我使用的 URL 编码器不断为我提供上面的第一个编码字符串。我正在使用 W3 联盟的 URLUTF8Encoder.java 。我必须使用这个,因为我正在开发一个需要 J2ME 的移动平台。
谢谢!
What is the difference between the following two encoded strings?
%D0%9E%D0%BA%D0%B6%D1%8D%D0%B7
and
%26%231055%3B%26%231088%3B%26%231080%3B%26%231074%3B%26%231077%3B%26%231090%3B
I am trying to URL Encode the russian text "Привет" into the second encoded string above (the W3Schools encoder does it correctly), but the URL encoder that I am using keeps giving me the first encoded string above. I am using URLUTF8Encoder.java from the W3 consortium. I have to use this one as I am working on a mobile platform requiring J2ME.
Thanks!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
w3schools 的 URL 编码器做得完全错误。
%D0%9E%D0%BA%D0%B6%D1%8D%D0%B7
完全有效。这也是我做的时候得到的当我按如下方式对 w3schools 的答案进行 URL 解码
时,我得到
Приве т
正是这些俄语字符,但随后转换为 XML 实体 首先。顺便说一下,w3schools 网站与 W3 Consortium 没有任何关系。另请参阅w3fools。
The URL encoder at w3schools is doing it utterly wrong. The
%D0%9E%D0%BA%D0%B6%D1%8D%D0%B7
is perfectly valid. That's also what I get when I doWhen I URL-decode the w3schools' answer as follows
then I get
Привет
which are exactly those Russian characters, but then converted into XML entities first.That w3schools site is by the way in no way related to W3 Consortium. See also w3fools.
您的字符串“Привет”编码为:
第二个字符串似乎在网址编码之前转换为 HTML 实体:
%26
is&
,%23< /code> 为
#
,%3B
为;
:Your string "Привет" is encoded as:
The second string seems to be converted into HTML entities before url-encoding:
%26
is&
,%23
is#
,%3B
is;
: