node.js - How can I determine which encoding JSON.stringify() used? -
i'm putting node/express app returning json serialized using json.stringify()
. i'd set content-type
http header include encoding info--such application/json; charset=utf-16
.
my understanding json.stringify()
might produce utf-16
or ucs-2
encoded results. how know encoding used serialize json, , what's best way inform user-agents of correct encoding?
as far understand, returns instance of type string
, defined sequence of 0 or more 16-bit unsigned integers (see spec).
i cite link above:
a string value member of string type. each integer value in sequence represents single 16-bit unit of utf-16 text. however, ecmascript not place restrictions or requirements on values except must 16-bit unsigned integers.
because of that, guess it's implementation defined. this maybe part of spec of interest you.
Comments
Post a Comment