1

When I make a query from the mysql console and it has accents or any character that needs to be utf-8 encoded, it gets mugged

INSERT INTO users (userName) VALUES ("José Alarcón");
SELECT userName FROM users;
José Alarcón

SET NAMES utF8 changes nothing --default-character-set=utf8 as parameter changes nothing Keep in mind than this is ONLY from the console. If I use phpmyadmin or make any query from a program, there is no problem at all, but an inserted row from the console gets muggled. I'm using putty on windows as client

~$ locale
LANG=en_US.UTF-8
LC_CTYPE="en_US.UTF-8"
LC_NUMERIC="en_US.UTF-8"
LC_TIME="en_US.UTF-8"
LC_COLLATE="en_US.UTF-8"
LC_MONETARY="en_US.UTF-8"
LC_MESSAGES="en_US.UTF-8"
LC_PAPER="en_US.UTF-8"
LC_NAME="en_US.UTF-8"
LC_ADDRESS="en_US.UTF-8"
LC_TELEPHONE="en_US.UTF-8"
LC_MEASUREMENT="en_US.UTF-8"
LC_IDENTIFICATION="en_US.UTF-8"
LC_ALL=

Clarification: Mi local computer is windows XP, i'm using putty 0.60 as terminal client. The target system where MySQL is running is a Debian linux I can't find any configuration in putty for character encoding...

Update: Stupid PuTTY, having the encoding configuration inside a menu called "translation" WTF?

1

3 Answers 3

2

Set PuTTY to interpret received data as UTF8 in Window -> Translation "Character set on received data".

Sign up to request clarification or add additional context in comments.

1 Comment

Ow, found out before your answer. But, It's the correct answer, so you get the accepted answer :-)
0

Windows can't handle UTF8 in console and system messages (which putty uses). It wants to use your locale codepage. This is a common and known problem, and it's not solvable without rewriting cmd.exe, or using a different command line tool.

Microsoft have never really bothered about encodings outside their own world, which results in weird windows specific codesets.

Maybe you can change the putty encoding somewhere in its options so that it can at least communicate correctly to the mysql cli?

3 Comments

@Matt - yes, but it still uses the native communication, which only accepts the locale codepage. I slightly edited the post.
So, i can't use a terminal client from Windows? there must be a way
Like I said, you may be able to configure putty to accept utf8 input. I don't have it so I'm not able to test it.
0

Your terminal client must be configured using UTF8. Your shell environment on the server must also be configured as UTF8. You can check it out with the following command.

locale

It depends on the distribution (I'm assuming you are using linux) how the system prefers how you fix the locale information if needed. For instance, Debian (and, I guess, Ubuntu) ask you to use the following command to reconfigure the locale settings.

dpkg-reconfigure locales

Notice; I'm not sure if they've changed this, haven't tested it in a while. :-)

You can of course set the locales in the shell each time you log in or in your profile. I recommend that you use the distribution's method to do it (if you need to do it after all :-)).

5 Comments

Uhhh. He has never said so. He only said he's using putty on Windows as the console client. He never said if he's using MySQL on Windows, Linux, or what ever else.
And yes, please take that down vote off my answer since it has no right to be there, since after all, I did read the question carefully and he does not state that if he's connecting to a linux server or just connecting to a local MySQL server running on his Windows computer.
P.S. In the comment above, I meant that PuTTY is a terminal client, not a console client. :-)
Thanks for the up vote. :-P On other matters. What character set is PuTTY using? You are able to change it in the properties/preferences window. Unfortunately I don't have this in front of me. @Tor Valamo 's answer was only mentioning if you were using PuTTY as a command prompt for Windows. You are able to use PuTTY as a SSH client with UTF8 encoding. The MySQL results should be displayed correctly if your ssh client (PuTTY) is configured to use UTF8 encoding and your shell environment (server side) is configured as you pasted in your last edit of your question.
I was thinking that Putty didn't had a encoding configuration (never found it before). It turned out it was in the "translation" option, I always overlooked it, I though it was for running putty in a different language, not a different encoding...

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.