Bug #9364 Accent problem with select into outfile
Submitted: 23 Mar 2005 16:58 Modified: 29 Mar 2005 8:41
Reporter: Eric Barthélémy Email Updates:
Status: Not a Bug Impact on me:
None 
Category:MySQL Server Severity:S3 (Non-critical)
Version:4.1 5.0.2-alpha OS:Windows (Windows XP)
Assigned to: Alexander Barkov CPU Architecture:Any

[23 Mar 2005 16:58] Eric Barthélémy
Description:
Hello,

I'm using mysql 4.1 et have tried on mysql 5.0.2-alpha.
When I insert data with special french character with accent é, à...
and that I use select command to see the line, I can see the
characters correctly.
But when I use the outfile command the characters are not in the
correct format.

I tried several charset and collation, but it seems that it's not the
problem.

Thanks.

How to repeat:
create table test (field1 varchar(40) not null) TYPE = InnoDB;

insert into test (field1)
values ("éèàù");

select *
INTO OUTFILE 'D:\\Eric\\Client\\IGA\\FRAM\\ficli\\test.txt' FIELDS TERMINATED BY ';' 
from test;
[29 Mar 2005 4:28] Alexander Barkov
Which program do you use to look into test.txt?
Can you please attach test.txt?
[29 Mar 2005 6:29] Eric Barthélémy
Test file

Attachment: test.txt (text/plain), 5 bytes.

[29 Mar 2005 6:30] Eric Barthélémy
I read the file with notepad or ultraedit.
[29 Mar 2005 8:41] Alexander Barkov
Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at
http://www.mysql.com/documentation/ and the instructions on
how to report a bug at http://bugs.mysql.com/how-to-report.php

Additional info:

Ok. I found the reason. It looks that you use "mysql.exe" to insert data.
The problem is that "mysql.exe" is a DOS-alike program which works in cp850, 
not in latin1.

You need to say "SET NAMES cp850;" when you connect from "mysql.exe".
Another solution is to add these lines into your my.cnf:

[mysql]
default-character-set=cp850

This is not a bug. I'm closing the report.
[7 Nov 2007 13:22] Julio Plato
Hi,

If SET NAMES cp850 solve this problem for this scenario, what can I do when an INSERT or UPDATE is issued from a JSP page using the com.mysql.jdbc.Driver.

Best regards.