1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
local function utf8_from(t)
	local bytearr = {}
	for _, v in ipairs(t) do
		local utf8byte = v < 0 and (0xff + v + 1) or v
		table.insert(bytearr, string.char(utf8byte))
	end
	return table.concat(bytearr)
end
local function utf8_expend(str) -- Put message
	local t = {}
	for num in str:gmatch('[^x]+') do
		table.insert(t, tonumber(num, 16))
	end
	return utf8_from(t)
end
1
2
3
2
3
print(utf8_expend('x61x7A')) --> 'az'
print(utf8_expend('xE4xBDxA0xE5xA5xBD')) --> '你好'
print(utf8_expend('xD0x9FxD1x80xD0xB8xD0xB2xD0xB5xD1x82')) --> 'Привет'
Convert utf8 encoding to string
1 
Offline