简体   繁体   English

Lua十六进制字符串转换为ASCII?

[英]Lua hex string to ASCII?

I'm wanting to convert a hex string to ASCII character, (for the game ROBLOX). 我想将十六进制字符串转换为ASCII字符(对于游戏ROBLOX)。

Here's the page for the ASCII icon: http://www.fileformat.info/info/unicode/char/25ba/index.htm 这是ASCII图标的页面: http : //www.fileformat.info/info/unicode/char/25ba/index.htm

Although I'm not even sure that Lua supports that icon. 尽管我什至不确定Lua是否支持该图标。

EDIT: 编辑:

Turns out ROBLOX doesn't support UTF-8 symbols at all due to their 'chat filtering'. 事实证明,由于ROBLOX的“聊天过滤”功能 ,它们根本不支持UTF-8符号

Strings in Lua are encoding-agnostic and you can just use the character in the string: Lua中的字符串与编码无关,您可以只在字符串中使用字符:

print"►"

Alternatively: 或者:

  • Output the Unicode code directly with print"\\u{25BA}" . 直接使用print"\\u{25BA}"输出Unicode代码。

  • Output the UTF-8 encoding directly with print"\\xE2\\x96\\xBA" . 直接用print"\\xE2\\x96\\xBA"输出UTF-8编码。

  • Output the UTF-8 encoding directly with print"\\226\\150\\186" . 直接使用print"\\226\\150\\186"输出UTF-8编码。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM