What is the default encoding used by an Object{Mapper,Reader} when reading from an InputStream?

1,361 views
Skip to first unread message

Francis Galiegue

unread,
Mar 9, 2014, 4:38:12 PM3/9/14
to jacks...@googlegroups.com
Admittedly, I haven't browsed through all the code yet. But I fail to
see what encoding is used in this case.

Is that the system's default encoding? UTF-8? Note: Jackson 2.2.x
--
Francis Galiegue, fgal...@gmail.com
JSON Schema in Java: http://json-schema-validator.herokuapp.com

Tatu Saloranta

unread,
Mar 9, 2014, 7:45:27 PM3/9/14
to jacks...@googlegroups.com
Encoding is determined as per JSON specification: either UTF-8, UTF-16 (big- or little-endian) or UTF-32. These are the only legal encodings for JSON as is.
There is no difference between data-binding cases as they all use same streaming parser code path.

In practice it is UTF-8 99+% of time.

-+ Tatu +-



--
You received this message because you are subscribed to the Google Groups "jackson-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jackson-dev...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Francis Galiegue

unread,
Mar 10, 2014, 5:42:35 PM3/10/14
to jacks...@googlegroups.com
On Mon, Mar 10, 2014 at 12:45 AM, Tatu Saloranta <tsalo...@gmail.com> wrote:
> Encoding is determined as per JSON specification: either UTF-8, UTF-16 (big-
> or little-endian) or UTF-32. These are the only legal encodings for JSON as
> is.
> There is no difference between data-binding cases as they all use same
> streaming parser code path.
>
> In practice it is UTF-8 99+% of time.
>

What i really wondered is whether it was autodetected, in fact.

Tatu Saloranta

unread,
Mar 10, 2014, 5:52:12 PM3/10/14
to jacks...@googlegroups.com
Right. It is auto-detected, using suggested algorithm presented in JSON specification.

-+ Tatu +-


Reply all
Reply to author
Forward
0 new messages