类型 函数 库 utf8.* 返回值 字符串 版本 发行版 2024.3703 关键字 utf8、UTF-8、Unicode、字符串、转义
将带有转义序列的字符串转换为
格式 | 说明 |
---|---|
%n |
n 是数字 Unicode 代码点 |
%{n} |
与 %n 相同,但带有花括号 |
%un |
与 %n 相同;u 代表“Unicode” |
%u{n} |
与 %{n} 相同;u 代表“Unicode” |
%xh |
十六进制数 |
%x{h} |
与 %xh 相同,但带有花括号 |
%? |
? 代表任何其他字符:转义此字符 |
utf8.escape( s )
字符串. 要转换的字符串。
local utf8 = require( "plugin.utf8" ) local testStr = utf8.escape( "%9825%32%{20320}%u{22909}%xFF0C%x{4E16}%x754C%32%9825" ) print( testStr ) --> ♡ 你好,世界 ♡