sile / jsone

Erlang JSON library
MIT License
291 stars 72 forks source link

Encoding issues #79

Closed silviucpp closed 2 years ago

silviucpp commented 2 years ago

Hello,

The following code:

P = [{<<"operatorname">>,<<"TELEFÓNICA MÓVILES ESPAÑA">>},{<<"originaloperatorname">>,<<"TELEFÓNICA MÓVILES ESPAÑA">>}],
    jsone:encode(P, [{float_format, [{decimals, 4}, compact]}]).

Throw the following error:

** exception error: bad argument
     in function  jsone_encode:escape_string/4
        called as jsone_encode:escape_string(<<"�NICA M�VILES ESPA�A">>,
                                             [{object_members,
                                               [{<<"originaloperatorname">>,
                                                 <<"TELEF�NICA M�VILES ESPA�A">>}]}],
                                             <<"{\"operatorname\":\"TELEF">>,
                                             {encode_opt_v2,false,false,
                                              false,
                                              [{decimals,4},compact],
                                              {iso8601,0},
                                              string,0,0,false,false,
                                              fun jsone:term_to_json_string/1})
silviucpp commented 2 years ago

Invalid. The input is not utf8 encoded.