michalmuskala / jason

A blazing fast JSON parser and generator in pure Elixir.
Other
1.58k stars 168 forks source link

Jason fails to encode #158

Closed ns-blee closed 1 year ago

ns-blee commented 1 year ago

Task #PID<0.2738.45> started from #PID<0.4447.45> terminating ** (Jason.EncodeError) invalid byte 0xFF in <<49, 255, 48, 52, 48, 32, 77, 66>> lib/jason.ex:213: Jason.encode_to_iodata!/2 (postgrex 0.16.5) lib/postgrex/type_module.ex:947: Postgrex.DefaultTypes.encode_params/3 (postgrex 0.16.5) lib/postgrex/query.ex:75: DBConnection.Query.Postgrex.Query.encode/3 (db_connection 2.4.2) lib/db_connection.ex:1255: DBConnection.encode/5 (db_connection 2.4.2) lib/db_connection.ex:1355: DBConnection.run_prepare_execute/5 (db_connection 2.4.2) lib/db_connection.ex:1459: DBConnection.run/6 (db_connection 2.4.2) lib/db_connection.ex:595: DBConnection.parsed_prepare_execute/5 (db_connection 2.4.2) lib/db_connection.ex:587: DBConnection.prepare_execute/4 (postgrex 0.16.5) lib/postgrex.ex:340: Postgrex.query/4 (ecto_sql 3.9.0) lib/ecto/adapters/sql.ex:947: Ecto.Adapters.SQL.struct/10 (ecto 3.9.1) lib/ecto/repo/schema.ex:756: Ecto.Repo.Schema.apply/4 (ecto 3.9.1) lib/ecto/repo/schema.ex:369: anonymous fn/15 in Ecto.Repo.Schema.do_insert/4 (nsMetrics 0.0.1) lib/parser/parser.ex:54: anonymous fn/4 in LogParser.route/3 (elixir 1.13.4) lib/task/supervised.ex:89: Task.Supervised.invoke_mfa/2 (elixir 1.13.4) lib/task/supervised.ex:34: Task.Supervised.reply/4 (stdlib 4.0.1) proc_lib.erl:240: :proc_lib.init_p_do_apply/3 Function: #Function<0.105103707/0 in LogParser.route/3> Args: []"},

michalmuskala commented 1 year ago

As stated in the other identical issue, you've opened: https://github.com/elixir-ecto/postgrex/issues/629

Jason works on UTF-8 and you have an invalid UTF-8 byte (0xFF).

This is expected behaviour. I'm going to close