Monday, 18 June 2018

If you are getting Invalid UTF-8 middle/second byte or other parsing errors within your JVM, just know


that  :

"The default charset is determined during virtual-machine startup and typically depends upon the locale and charset being used by the underlying operating system."

This is an official excerpt from  :



Other sources that just relate to how to determine or set it up:



Now, how do you know what character set is your JVM defaulting to?

In debug, try to execute the following command:

java.nio.charset.Charset.defaultCharset()

You will get one of the charset listed here (most popular being  iso-8859-1):


To make sure you have a broad encoding character set, solve this issue by overriding your system charset by starting the jvm with this option:


-Dfile.encoding=UTF-8


Familiar exceptions :

       


com.fasterxml.jackson.core.JsonParseException:



com.ctc.wstx.exc.WstxIOException: Invalid UTF-8 middle byte 0x... 

No comments:

About Me

My Photo