File encoding in H2 database

I’m using the WildFly 10 distrubution for Windows and the built in H2 database for development. In my JSF application I can upload a CSV file which works fine locally. When I copy the .war file to the server (CentOS 7) and upload the CSV file I got question marks in strings in the database. Seems like there is an encoding problem.
So far I have checked to make sure that from the JSF form comes UTF-8 with

h:form enctype=“multipart/form-data” acceptcharset=“UTF-8”

I tried also the parse the InputStream as UTF-8 but nothing worked. If someone has a hint I would be very glad.

Hi @jome,

could you check encoding of your CSV file? Or attach it here.


Hi @aakhmerov,

thanks for quick reply it’s iso-8859-1.


I think what your example with input stream does, is telling InputStreamReader to read bytes as UTF-8, while in reality file contains another encoding. So when you read it, it doesn’t match. If that assumption is correct, possible solutions would be either to convert file to UTF-8, or tell InputStreamReader to use iso-8859-1.


I’ve just re-read the link and you’re right.
As the information stored in the database will be also shown in lists on the web seems like I have to convert it.
Thanks @aakhmerov

Well working with the BufferedReader was not completely wrong.

new BufferedReader(new InputStreamReader(is, “ISO-8859-1”))

Did the trick.
Thanks again @aakhmerov !