1

I have a database with some cratian characters in it like Đ , in the database the character is stored correctly, when using a datatable in primefaces it also shows the character in the webpage just fine.

The problem is that when I send it to the out.println() the character Đ in the name is missing.

 for (People p : people) {
     System.out.println("p.getName());
 }

I tried using String name2 = p.getName().getBytes("ISO-8859-2"); but it still not working

Vivek Singh
  • 2,047
  • 11
  • 24
Alexev
  • 157
  • 2
  • 19
  • Answer: http://stackoverflow.com/a/17551962/1172714 The problem is a mismatch between the encoding you output and the encoding that whatever stdout is connected to (terminal, IDE console, etc) expects to receive. – dsh Nov 03 '15 at 13:31
  • Alexev, you say the character is stored in the database correctly, but can you tell us what encoding it is stored in? – Breandán Dalton Nov 03 '15 at 13:32
  • The mysql encoding is UTF8 – Alexev Nov 03 '15 at 13:52

1 Answers1

1

I assume you are using UTF-8 as default encoding on the Database and for Primefaces

Have also a look to this:

Display special characters using System.out.println

Community
  • 1
  • 1
ctarabusi
  • 343
  • 1
  • 11