]> git.sesse.net Git - vlc/commitdiff
lua dkjson: use us_tostring() to fix locale issues with decimals
authorPierre Ynard <linkfanel@yahoo.fr>
Sat, 31 Aug 2013 15:29:33 +0000 (17:29 +0200)
committerPierre Ynard <linkfanel@yahoo.fr>
Sat, 31 Aug 2013 15:29:33 +0000 (17:29 +0200)
This only fixes encoding but we don't use decoding anyway.

Fixes #8854

share/lua/modules/dkjson.lua

index 987587bbc5ec5b492d67f4d7c60396b6f21de18b..05bf11c9baacffa38381b2ace32b1258235eba7e 100644 (file)
@@ -196,6 +196,8 @@ local strrep, gsub, strsub, strbyte, strchar, strfind, strlen, strformat =
       string.rep, string.gsub, string.sub, string.byte, string.char,
       string.find, string.len, string.format
 local concat = table.concat
+local common = require ("common")
+local us_tostring = common.us_tostring
 
 if _VERSION == 'Lua 5.1' then
   local function noglobals (s,k,v) error ("global access: " .. k, 2) end
@@ -367,7 +369,7 @@ encode2 = function (value, indent, level, buffer, buflen, tables, globalorder)
       -- This is the behaviour of the original JSON implementation.
       s = "null"
     else
-      s = tostring (value)
+      s = us_tostring (value)
     end
     buflen = buflen + 1
     buffer[buflen] = s