forums › forums › SQLyog › Using SQLyog › Encoding Problems
- This topic is empty.
-
AuthorPosts
-
-
February 6, 2011 at 10:21 am #12249ninoidMember
Dear sqlyog comunity,
I am using sqlyog and I am very satisfied.
I write some code in java on my windows machine and when insert into mysql database i lost some characters.
For example my string contains these characters: 'Č','č','Ć','ć','Đ','đ' and when I write them into database i got ???????
But when I write these characters directly through sqlyog as table data and save hey encode correctly.
My database charset is utf8 and collation is utf8_unicode_ci.
Please help.
All the best
ninoid
-
February 6, 2011 at 10:48 am #31932peterlaursenParticipant
Please read this: http://www.webyog.com/faq/content/34/152/en/my-special-characters-display-as-_noisy_-latin-characters-in-sqlyog.html
It is not a problem with SQLyog. SQLyog displays what is stored in the database. If you dump such table and open in Notepad or a similar text-editor you will see the same garbling happen
I am not very familiar with JAVA (and nobody at Webyog are as we do not use JAVA) but from your JAVA application you should handle the encoding of strings stored so that the client app sends encoded strings that match the charset for database/table/column where it is stored. You may SET NAMES but also JAVA may have some API/function to handle it.
Maybe this will help: http://dev.mysql.com/doc/refman/5.1/en/connector-j-reference-charsets.html
-
February 6, 2011 at 10:51 am #31933peterlaursenParticipant
this “match the charset for database/table/column where it is stored” should rather be “match the charset for for the connection and client”. MySQL can handle client charset different from charset used for storage.
-
February 7, 2011 at 6:58 am #31934ninoidMember
I didn't say tha sqlyog makes problems. On the contrary with sqlyog works great. When I write characters “ČčĆćĐđ” through sqlyog
as table data and save them they encode correctly in mysql database.
Problem is with my java app. So I am confused and I know that you are professionals so I write post here.
I make database with sqlyog and set charset utf8, collation utf8_unicode_ci.
Then I enter string “ČčĆćĐđ” in my Java app. I save to database and I got ??????
I assume that java default charset for my string is utf8.
Any idea?
-
February 7, 2011 at 8:33 am #31935peterlaursenParticipant
I can only refer to the JDBC-connector documentation that I linked to before. I am sorry but we do not use JAVA with MySQL ourselves.
Anyway you may try to
1) Attach a small dump of such table (both structure and data).
2) Execute “SHOW VARIABLES like '%character%';” on this server
-
February 7, 2011 at 11:50 am #31936vishal.prMember
Hi ninoid,
If it is a string hard coded inside the source making the problem, then it might be a file encoding problem with javac compiler. Make sure you use the proper command line to compile.
This link may be helpful.
-
February 8, 2011 at 7:12 am #31937ninoidMember
Hi people.
I found solution 😛
Problem was in jdbc connection string.
jdbc:mysql://localhost/some_db means that if encoding is not eyxplicitly specified jdbc will use deault system codepage.
Therefroe in my case will convert java utf8 string to windows-1250 and send to mysql database with utf8 charset.
But when I set connection string as jdbc:mysql://localhost/some_db?useUnicode=yes&characterEncoding=UTF-8
jdbc will encode java string to utf8 and send to mysql database…
THANKS TO ALL…
-
-
AuthorPosts
- You must be logged in to reply to this topic.