X-Git-Url: http://git.archive.openwrt.org/?a=blobdiff_plain;f=libs%2Fweb%2Fluasrc%2Fhttp.lua;fp=libs%2Fweb%2Fluasrc%2Fhttp.lua;h=c53307a5a1eb4e2b3d72fabc6f2e0379c833eabd;hb=2675ad1c63604018d72c8f3d4fff3f28f6f5b52c;hp=18112507ce3565b6e7643ab8060fa61636282203;hpb=c9556c02bb49d5eee903ade2e73ea586ee09afde;p=project%2Fluci.git diff --git a/libs/web/luasrc/http.lua b/libs/web/luasrc/http.lua index 18112507c..c53307a5a 100644 --- a/libs/web/luasrc/http.lua +++ b/libs/web/luasrc/http.lua @@ -4,9 +4,6 @@ LuCI - HTTP-Interaction Description: HTTP-Header manipulator and form variable preprocessor -FileId: -$Id$ - License: Copyright 2008 Steven Barth @@ -334,12 +331,14 @@ function write_json(x) end elseif type(x) == "number" or type(x) == "boolean" then if (x ~= x) then - -- NaN is the only value that doesn't equal to itself. + -- NaN is the only value that doesn't equal to itself. write("Number.NaN") else write(tostring(x)) end else - write("%q" % tostring(x)) + write('"%s"' % tostring(x):gsub('["%z\1-\31]', function(c) + return '\\u%04x' % c:byte(1) + end)) end end