0

I've been trying to build an application that stores text contents in any language into my database and retrieve the same. I am using postgres as my database and Hibernate as db framework.

The problem is that when i try to store a text into database using hibernate , it is getting printed in a different format in the javaEE server.

for eg: a text that i entered in the input box as " ജനുവരി " in malayalam is getting printed as " �?ന�?വരി " in the javaEE server.

The same scenario , when i tried using normal php code and php-postgres db connection is working fine. I am able to store language eg. hindi, tamil, telugu,malayalam etc into database and can retrieve and show in the html page without any troubles or loss of content. In this case i am able to read the content even through the pg-admin (postgres workbench) console.

But this same content , when i tries to fetch using javaEE hibernate query, i am getting a result like '?????????' even though i am able to read the actual content through the workbench.

I tried to set UTF8 encoding to my hibernate config file . but nothing seems to be working . any help on this will be greatly appreciated.

Thanks in advance.

  • 1
    I think you need to change your database Encoding to UTF-8 not hibernate. – Mohamed Nabli Mar 13 '17 at 09:41
  • Hi, my database is postgres and its db server encoding is "UTF8" by default.I tried by setting the database encoding as "utf8" inside my hibernate-config file. but even that didn't helps. – Rony Varghese Mar 13 '17 at 09:52
  • BalusC has marked this as a duplicate of http://stackoverflow.com/questions/13108466/unicode-characters-in-servlet-application-are-shown-as-question-marks . but like the answer in that question, i am not using any jsp pages. I am using hibernate and java only in my server side and my client application is android. – Rony Varghese Mar 14 '17 at 07:32
  • Do you use java servlets to generate the html responses? Maybe the response encoding is wrong. – The Bitman Mar 15 '17 at 17:44

0 Answers0