0

i'm trying to read some arabic text from a mysql database,i'm using jsf2 and jpa ,EclipseLink as ORM. I've already added useUnicode=yes&characterEncoding=UTF-8&characterSetResults=UTF-8 to my connection pool and my database has utf8_general_ci as character encoding and still not working,i've got just question marks "??????".

STF
  • 1,485
  • 3
  • 19
  • 36

2 Answers2

-1

Use a Collection called UTF8-GENERAL-CI and use it in all text fileds enter image description here

-1

Try changing your db collation to utf8 unicode. general is kind of old school and has issues with non latin languages. When you get the text from db do you get characters, but not what you expected? Does it show correctly in db?

$MySQL_Handle = mysqli_connect(HOSTNAME,DATABASE_USERNAME,DATABASE_PASSWORD,DATABASE_NAME) 
$sSQL= 'SET CHARACTER SET utf8'; 
mysqli_query($MySQL_Handle,$sSQL) 
nick
  • 789
  • 1
  • 11
  • 27
  • yeah, it shows correctly in DB, but i get question marks using System.out.println....it can be related to my IDE configuration?? – Mohamed Elhazdour Mar 24 '17 at 16:30
  • did you try changing db collation? You might need to change the character set used, try set character after your connect (before query). check the edit. – nick Mar 24 '17 at 16:37
  • this is my connection : `"jdbc:mysql://localhost:3306/db_name?zeroDateTimeBehavior=convertToNull&useUnicode=yes&characterEncoding=UTF-8&characterSetResults=UTF-8` – Mohamed Elhazdour Mar 24 '17 at 16:45
  • Try something like this with the string: String arabicString = new String("كيف حالك".getBytes(), "UTF-8"); otherwise maybe change encoding in ide but probably already utf8 Unicode by default – nick Mar 24 '17 at 19:29