Bug #1558 strange characters
Submitted: 15 Oct 2003 6:13 Modified: 21 Oct 2003 6:16
Reporter: Rafael Sacramento Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server: Command-line Clients Severity:S3 (Non-critical)
Version:4.0.12 OS:Windows (win XP pro)
Assigned to: Alexander Barkov CPU Architecture:Any

[15 Oct 2003 6:13] Rafael Sacramento
Description:
when i use the command line, all characters from my language (portuguese) display correctly. But if i'm using it to work with mysql, some chars appear incorrect: ç,ã,ò, ó and so on; in my my.cnf file i wrote language = portuguese. 
How do i establish my language with mysql?
example:
... VocÛ tem um erro de sintaxe no seu SQL pr¾ximo ...

How to repeat:
mysql> use jokes;
Database changed
mysql> dgçlkj
    -> ;
ERROR 1064: VocÛ tem um erro de sintaxe no seu SQL pr¾ximo a 'dgçlkj' na linha 1
mysql> hvkhvjk
    -> ;

Suggested fix:
dont know, but must have to do with latin chars...
[17 Oct 2003 22:27] MySQL Verification Team
I am explain you why I marked as Won't fix this bug report.
Please using the Explorer go to directory:

mysql\\share\portuguese

you should find 2 files: errmsg.txt and errmsg.sys

Open with the WordPad application the file errmsg.txt.
If you have enabled the Portuguese as Windows Regional setting, you should
see like me that the letters and accents are correct: ç, õ, são..etc.
Now open a DOS prompt screen and using the Edit tool open the same file
you should see the wrong characters like you are reported.

This happens because the errmsg.txt was edited using a graphical tool
and the DOS prompt screen doesn't has the adequate font for to show
the correct characters. For to correct this I will need to edit that
file using the Edit tool under the DOS prompt screen but the graphical
screen will shows the wrong characters.

So while we use a text file as source of the messages error and Windows
only has 2 fonts for text screen will have one of the 2 modes showing
the wrong characters, in another words if I fix the text mode I will bug
the graphical mode.
[19 Oct 2003 19:18] Rafael Sacramento
i'm just a beguiner with Mysql and after reading your qnswer i tried to find/replace some chars in edit mode; what hapened was extraordinary: now my language is english; i tried this but you can see the answer...:
shell>C:\mysql\bin>mysqld-nt --language=portuguese
031019 18:21:20  Can't read from messagefile 'c:\mysql\share\portuguese\errmsg.sys'
031019 18:21:20  Aborting
what can i do now?
[19 Oct 2003 20:27] MySQL Verification Team
Then let me to explain you how to use the utility comp-err.exe which you
should find in your \mysql\bin directory.
I deleted the file \mysql\share\portuguese\errmsg.sys.
I opened a DOS prompt screen and did:

e:\servers\mysql\share\portuguese>edit errmsg.txt

and modified the wrong character showed with the message displayed
for to start the server: "%s: Pronto para conexäes\n",
and saved the file.

Now I did the below command for to create the new errmsg.sys:

e:\servers\mysql-4.0.15\share\portuguese>e:\servers\mysql-4.0.15\bin\comp-err er
rmsg.txt e:\servers\mysql-4.0.15\share\portuguese\errmsg.sys
Found 238 messages in language file e:\servers\mysql-4.0.15\share\portuguese\err
msg.sys

how you can see below, now the message is displayed correctly when the server
is started as standalone from a DOS screen:

E:\servers\scripts>e:\servers\mysql-4.0.15\bin\mysqld-max-nt --defaults-file=e:/
servers/mysql-4.0.15/my.ini --standalone --console --language=portuguese
031020  1:11:15  InnoDB: Started
e:\servers\mysql-4.0.15\bin\mysqld-max-nt: Pronto para conexões
[19 Oct 2003 23:49] Alexander Barkov
Miguel is wrong that we'll not fix this issue.
We'll not fix it in 4.0.x, it can work with the only
one character set at the same time.

But we will fix it in 4.1 branch, and we're already working on fixing it.
I hope it will work fine in the next, 4.1.1 release.

4.1 branch supports many character sets at the same time,
and it will also be able to convert error messages into
the client character set, which is cp850 in the case of Portuguese
DOS client.

I'm reopening this bug and I'll take care of it.
[20 Oct 2003 11:41] Rafael Sacramento
thanks Miguel: i just did what you said and went fine
Alexander: so you say that if i upgrade to the next release this problem will probably end? And that by now it has no way out?
thanks to both
[20 Oct 2003 23:37] Alexander Barkov
Thank you for your bug report. This issue has been committed to our
source repository of that product and will be incorporated into the
next release.

If necessary, you can access the source repository and build the latest
available version, including the bugfix, yourself. More information 
about accessing the source trees is available at
    http://www.mysql.com/doc/en/Installing_source_tree.html

I musunderstood the complaint initially and
reopened the bug in mistake.

As it does work fine in 4.1.x, so I'm closing it.
[21 Oct 2003 6:16] Sergei Golubchik
small addition:

"It does work fine in 4.1" means that in 4.1 MySQL supports that client and server can have different charsets and it (server) will translate the data on the fly, transparently.

With 4.1 after connect with mysql.exe you do

mysql> SET NAMES cp850;

to inform the server about your client's charset. Then you will see all accented characters correctly.