Commit 1e9dc296 authored by Pierre Ynard's avatar Pierre Ynard

lua http: use us_tostring() to fix locale issues with decimals

The function is a bit ugly but it's difficult to do this using
pure arithmetic.

Fixes #6378
parent e604141e
......@@ -68,6 +68,13 @@ function us_tonumber(str)
return s * (tonumber(i) + tonumber(d)/(10^string.len(d)))
end
-- tostring() for decimals number, using a dot as decimal separator
-- regardless of the system locale
function us_tostring(n)
s = tostring(n):gsub(",", ".", 1)
return s
end
-- strip leading and trailing spaces
function strip(str)
return string.gsub(str, "^%s*(.-)%s*$", "%1")
......
......@@ -24,6 +24,7 @@
module("httprequests",package.seeall)
local common = require ("common")
local dkjson = require ("dkjson")
......@@ -197,6 +198,8 @@ end
function xmlString(s)
if (type(s)=="string") then
return vlc.strings.convert_xml_special_chars(s)
elseif (type(s)=="number") then
return common.us_tostring(s)
else
return tostring(s)
end
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment