0

Hello im braking my head with a problem, im using netbeans building a web application using java, jsp that handel a database with hebrew fields.

String cityTable = "CREATE TABLE IF NOT EXISTS hebrew_test.table ("
                            +"id int(11) NOT NULL AUTO_INCREMENT,"
                            +"en varchar(30) NOT NULL,"
                            +"he varchar(30) COLLATE utf8_bin NOT NULL,"
                            +"PRIMARY KEY (id)"
                            +") ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin AUTO_INCREMENT=1;";
String insert = "INSERT INTO hebrew_test.table (en, he) VALUES ('A','a')";
String insert2 = "INSERT INTO hebrew_test.table (en, he) VALUES ('B','ב')";
String insert3 = "INSERT INTO hebrew_test.table (en, he) VALUES ('C','אבג')";


executeSQLCommand(cityTable);
executeSQLCommand(insert);
executeSQLCommand(insert2);
executeSQLCommand(insert3);

the output tabel i get:
1   A   a
2   B   ?
3   C   ???

instead of:
1   A   a
2   B   ב
3   C   אבג

tried: hebrew appears as question marks in netbeans : Click Here
but that isnt the same problem. i get the question marks in the tabel.

also i defined the tabel to be in UTF8_bin as you can see in the above code.

if you need more information tell me and ill publish here.

ideas? thank you.

3
Contributors
5
Replies
6
Views
4 Years
Discussion Span
Last Post by matan2t
Featured Replies
  • 1

    You better create your tables with appropriate charset parameters something along the line of CREATE TABLE IF NOT EXISTS `test` ( `id` int(10) NOT NULL, `name` varchar(10) collate utf8_unicode_ci NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; Read More

0

no i didnt, that is the problem :)
the answear is to put :
jdbc:mysql://localhost:3306/db_name?useUnicode=yes&characterEncoding=UTF-8

1

OK, you need to check your mysql database table field which stores the data. You need its collation to be set to utf8-bin or something like that. Then you may need to rewrite to your database and read it again to see whether it works.

1

You better create your tables with appropriate charset parameters something along the line of

CREATE TABLE IF NOT EXISTS `test` (
  `id` int(10) NOT NULL,
  `name` varchar(10)
  collate utf8_unicode_ci NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.