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.

Does your database support the character type though?

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

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.

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;

thank you all really helped.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.