mirror of
https://github.com/lunarmodules/lua-iconv.git
synced 2025-06-23 04:34:33 +02:00
18 lines
428 B
Lua
18 lines
428 B
Lua
|
|
cd = iconv.new("utf-8", "iso-8859-1")
|
|
-- cd = iconv.new("utf-8//IGNORE", "iso-8859-1")
|
|
-- cd = iconv.new("utf-8//TRANSLIT", "iso-8859-1")
|
|
|
|
assert(cd, 'Invalid conversion')
|
|
|
|
ret, err = cd:iconv('Isso é um teste com acentuação')
|
|
|
|
if err == iconv.ERROR_INCOMPLETE then
|
|
print('Error: Incomplete input.')
|
|
elseif err == iconv.ERROR_INVALID then
|
|
print('Error: Invalid input.')
|
|
elseif err == nil then
|
|
print('Result: ', ret)
|
|
end
|
|
|