Win a copy of Think Java: How to Think Like a Computer Scientist this week in the Java in General forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

MySQL and foreign languages

 
Aris Doxakis
Ranch Hand
Posts: 136
Android Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello,

i have an application that uses jsp with mysql as database server.
are there any settings that it has so it can show Greek language??

everything works ok but when i use a table to fill a select it doesnt show the data in the table...

thnx in advance.
 
Paul Clapham
Sheriff
Posts: 21107
32
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You do need to configure MySQL to use UTF-8 for your tables. Its default is Latin-1 which is not suitable for Greek. And you do need to make your JSPs use UTF-8 as the response encoding as well. And when you are trying to find out why you don't see Greek characters correctly, don't try testing both MySQL and JSP at the same time. Test them separately.
 
Aris Doxakis
Ranch Hand
Posts: 136
Android Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
thnx for your reply,

do i have to set utf-8 for each table or just set mysql for each database i have created???i set it uo from mysql administrator?
 
Paul Clapham
Sheriff
Posts: 21107
32
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I don't know. I would look it up in the MySQL documentation for you, but it's on my home computer and I'm at work. There's a whole section about encodings and collations. You will find it in the MySQL "docs" directory (I think) on your computer.
 
stu derby
Ranch Hand
Posts: 333
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Paul Clapham:
I don't know. I would look it up in the MySQL documentation for you, but it's on my home computer and I'm at work. There's a whole section about encodings and collations. You will find it in the MySQL "docs" directory (I think) on your computer.

The MySQL documentation is also online at:
http://dev.mysql.com/doc/refman/5.0/en/charset.html
 
Paul Clapham
Sheriff
Posts: 21107
32
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Of course I should have known the documentation would be on line.
 
Masoud Kalali
Author
Ranch Hand
Posts: 531
Java Mac OS X Netbeans IDE
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Aris Doxakis:
thnx for your reply,

do i have to set utf-8 for each table or just set mysql for each database i have created???i set it uo from mysql administrator?


AFAIR
If you build database using utf 8 then all tables will be utf 8
because you database default encoding is utf-8
along with this you will need to add some extra parameter to your connection string , it could be like :


hth
 
Aris Doxakis
Ranch Hand
Posts: 136
Android Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i found the language files but i cant find out how to setup the language???
 
Aris Doxakis
Ranch Hand
Posts: 136
Android Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
the tables that i have on my dayabase are mostly with greek written data.
sow when i use them in my jsp pages they are showed as $%#%^$@#$.
do i have to setup my database as greek or my tables individualy???
and how because i cant find anything on the manuals

i use mysql 4.1 ....
thxs\

\
 
Paul Clapham
Sheriff
Posts: 21107
32
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Okay. Now is that happening because the data in the database is corrupt, or because it is being corrupted when your JSP sends it to the browser? I suggested already to not test both of those things at the same time. So just write a Java application that reads from the database and displays data in a Swing GUI. If that shows correct data then you are doing the JSP wrong. If it shows incorrect data then the database is probably set up wrong.

Let us know what your tests show.
 
Aris Doxakis
Ranch Hand
Posts: 136
Android Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
when i use the data from tables that there data is in english there is no problem in presenting them.but when i access tha data that are in greek theres my problem.

i dont think there is anything corrupt in my database either that there is something wrong with the jsp page because i am using a result set very simple made.


thnx
 
Paul Clapham
Sheriff
Posts: 21107
32
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i dont think there is anything corrupt in my database either
That doesn't sound like you did any testing at all. You still don't know that when you read something from your database, you get the correct data. The test you should do for the database is very simple: write a query that will return one column of one row, whose value you know. Then the test is this:
 
Aris Doxakis
Ranch Hand
Posts: 136
Android Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i made the test.the data isnt returned correct when i use the tables that are written in greek..when i take the data from tables with english data they are returned correctly..

if that is what you are asking of me..
hope i understood your question right.
 
Aris Doxakis
Ranch Hand
Posts: 136
Android Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
one more thing..
is it because i use winXP en???
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic