aboutsummaryrefslogtreecommitdiff
path: root/test/functional/eval/json_functions_spec.lua
diff options
context:
space:
mode:
Diffstat (limited to 'test/functional/eval/json_functions_spec.lua')
-rw-r--r--test/functional/eval/json_functions_spec.lua8
1 files changed, 8 insertions, 0 deletions
diff --git a/test/functional/eval/json_functions_spec.lua b/test/functional/eval/json_functions_spec.lua
index 8483152dbf..bed9d668fa 100644
--- a/test/functional/eval/json_functions_spec.lua
+++ b/test/functional/eval/json_functions_spec.lua
@@ -521,6 +521,14 @@ describe('json_decode() function', function()
local str = ('%s{%s"key"%s:%s[%s"val"%s,%s"val2"%s]%s,%s"key2"%s:%s1%s}%s'):gsub('%%s', s)
eq({key={'val', 'val2'}, key2=1}, funcs.json_decode(str))
end)
+
+ it('always treats input as UTF-8', function()
+ -- When &encoding is latin1 string "«" is U+00C2 U+00AB U+00C2: «Â. So if
+ -- '"«"' was parsed as latin1 json_decode would return three characters, and
+ -- only one U+00AB when this string is parsed as latin1.
+ restart('set encoding=latin1')
+ eq(('%c'):format(0xAB), funcs.json_decode('"«"'))
+ end)
end)
describe('json_encode() function', function()