如何将Unicode用十六进制转换为飞镖 /扑朔迷离
%U0BB5%U0BA3%U0B95%U0BCD%U0B95%U0BAE%U0BAE%U0BCD
上方是unicode,带有十六进制字符字符串 需要将其转换为可读文本 解码时,以上文本将返回வணக்கம்表示欢迎
%u0BB5%u0BA3%u0B95%u0BCD%u0B95%u0BAE%u0BCD
Above is unicode with hex characters string
Need to convert that to readable text
When decoded, the above text will return வணக்கம் meaning welcome
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
如果您想要一个硬编码的字符串,如 flutter中的特殊字符
和“ nofollow noreferrer”> the dart语言之旅 ,您可以使用
\ u
指定Unicode代码点:如果给出了字符串
'%U0BB5%U0BA3%U0B95%U0B95%U0BCD%U0B95%U0B95%U0BAE%U0BCD'要在运行时动态转换,您将需要:
%uxxxx
组件。XXXX
部分作为十六进制整数以获取代码点。字符串
。编辑1
调整后的版本,可以用编码的代码点和未编码的字符来处理字符串:
编辑2
上述版本假定您的输入仅由Unicode代码点组成,该点数编码为
>%uhhhh
(其中H,其中H是十六进制的数字)和原始的ASCII字符。但是,您的这个问题的新版本表示您实际上需要处理:Unicode> %uhhhh
。%HH
。要处理第三种情况:
打印:
有些软件包可以渲染html(例如代码> 以及其他各种)。否则,我将考虑与HTML打交道以超出此答案的范围,无论如何,这应该应得的问题。
If you want a hard-coded string, as noted in Special characters in Flutter
and in the Dart Language Tour, you can use
\u
to specify Unicode code points:If you are given a string
'%u0BB5%u0BA3%u0B95%u0BCD%u0B95%u0BAE%u0BCD'
and need to convert it dynamically at runtime, then you will need to:%uXXXX
components.XXXX
portion as a hexadecimal integer to get the code point.String
from the code points.Edit 1
An adjusted version that can handle strings with a mixture of encoded code points and unencoded characters:
Edit 2
The versions above assumed that your input would consist only of Unicode code points encoded as
%uHHHH
(where H is a hexadecimal digit) and of raw ASCII characters. However, your new version of this question indicates that you actually need to handle a mixture of:%uHHHH
.%HH
.To handle that third case:
which prints:
There are packages that can render HTML (e.g.
package:flutter_html
and probably various others). Otherwise I'm going to consider dealing with the HTML to be outside the scope of this answer, and that would deserve its own question anyway.