dbTalk Databases Forums  

character set problem

comp.databases.mysql comp.databases.mysql


Discuss character set problem in the comp.databases.mysql forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Alessandro Topo Galileo
 
Posts: n/a

Default character set problem - 11-15-2010 , 07:00 AM






Hello, I'me not able to solve a character set problem.
I have two linux PC: PC1 is OpenSuSE 10.2 and PC2 is OpenSuSE 11.3.
Database is on PC2.
Table has TABLE_COLLATION='latin1_swedish_ci'.
I must insert and select characters like "à", it has "E0" code on:
http://www.collation-charts.org/mysq...wedish_ci.html
I use command line mysql or connect from php, results are the same.

Select from PC1: it works on rows inserted by PC1, it has bad characters
on rows inserted by PC2.
Select from PC2: it does not work (all rows have bad characters).

I think the problem is "the client" but I'm not able to find the solution.

From command line, command "locale" gives the same result on both PCs:
LANG=it_IT@euro
LC_CTYPE="it_IT@euro"
LC_NUMERIC="it_IT@euro"
LC_TIME="it_IT@euro"
LC_COLLATE="it_IT@euro"
LC_MONETARY="it_IT@euro"
LC_MESSAGES="it_IT@euro"
LC_PAPER="it_IT@euro"
LC_NAME="it_IT@euro"
LC_ADDRESS="it_IT@euro"
LC_TELEPHONE="it_IT@euro"
LC_MEASUREMENT="it_IT@euro"
LC_IDENTIFICATION="it_IT@euro"
LC_ALL=

Thank you for any suggestion.

Reply With Quote
  #2  
Old   
Willem Bogaerts
 
Posts: n/a

Default Re: character set problem - 11-15-2010 , 07:22 AM






On 15/11/10 14:00, Alessandro Topo Galileo wrote:
Quote:
Hello, I'me not able to solve a character set problem.
I have two linux PC: PC1 is OpenSuSE 10.2 and PC2 is OpenSuSE 11.3.
Database is on PC2.
Table has TABLE_COLLATION='latin1_swedish_ci'.
I must insert and select characters like "à", it has "E0" code on:
http://www.collation-charts.org/mysq...wedish_ci.html
I use command line mysql or connect from php, results are the same.
Upon connecting to the database server, it is good to send a "SET NAMES"
command to set the character encoding. So if you want to speak UTF-8 to
your database, send the command "SET NAMES utf8".

The MySQL server defaults to speaking latin-1.

If you really want to make sure that the right character gets inserted
on whatever system, you can use encoding prefixes and hexadecimal
values. This can come in handy for database creation scripts. So your
lower case a grave can, for example, be denoted with "_utf8 0xC3A0".
MySQL itself will convert this character to whatever encoding the field has.

But normally, sending the SET NAMES command as the first statement and
"speaking" the encoding set in that statement does the job entirely.

Best regards,
--
Willem Bogaerts

Application smith
Kratz B.V.
http://www.kratz.nl/

Reply With Quote
  #3  
Old   
Alessandro Topo Galileo
 
Posts: n/a

Default Re: character set problem - 11-15-2010 , 07:59 AM



Il 15/11/2010 14:22, Willem Bogaerts ha scritto:

Quote:
But normally, sending the SET NAMES command as the first statement and
"speaking" the encoding set in that statement does the job entirely.
GREAT! It works.
Thank you very much.

Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.