Re: Suse Linux (SLES10), Portuguese characters and dead keys in MySQL monitor in SSH sessions with Unicode (UTF-8)

2007-08-08 Thread Ricardo Dias Marques
Hi all,

Here I am, following up to my own post - available below and at
http://lists.mysql.com/mysql/208343 - with a solution (basically, a
workaround).

To summarize: I couldn't enter Portuguese accented characters in
MySQL monitor (MySQL command line / console client), when I'm in a
SSH (Secure Shell) Session, in a SUSE Linux Enterprise Server 10,
configured to use Unicode (UTF-8 encoding).

The Portuguese accented characters appeared well, in the same SSH
session, for other shell (bash) commands and in Vim editing sessions
(using the same Portuguese keyboard with accent keys that are dead
keys).

To make a long story short, the problem does NOT seem to be related
with the SSH session, but seems to be related with the shell *user*
that I use to login:

1 - If I log in to the shell of the Linux server with a regular user,
either through a SSH session or directly in the local console (the one
physically attached to the server) and I do a su to change to the
root user, then the following happens: when I enter the mysql
console (by entering the mysql command), the accented characters do
NOT appear (typing ã - lowercase a with tilde accent - appears as a #
- hash sign).

2 - If I log in to the shell of the Linux server directly with the
root user, when I enter the mysql console (by entering the mysql
command) all the accented characters appear correctly (this also
happens either in a SSH session or by logging in directly in the local
console).

Like I said in my previous post, this server has the following MySQL version:
5.0.41-community MySQL Community Edition (GPL).

I forgot to mention that I'm using bash shell - GNU bash, version
3.1.17(1)-release (i586-suse-linux) and that my readline version is
5.1-24.4

The bug is also happening in another server that's using version
5.0.45-community MySQL Community Edition (GPL).

Did anyone else have this problem? If so, how did you solve it? Did
you change everything from UTF-8 back to ISO-8859-1? *Or* do you enter
directly as root, as I'm doing now (to work around this issue)? *Or*
do you simply do NOT type accented characters directly in the MySQL
Monitor (that is, the command line mysql client)?


Thanks in advance for any info that you may give me!  :)

Best wishes,
Ricardo Dias Marques
newsgroup DOT posts AT gmail DOT com


On 7/31/07, Ricardo Dias Marques [EMAIL PROTECTED] wrote:

 Hi all,

 First of all, sorry for the lengthy subject, but it serves to describe
 my problem:

 I'm having problems entering Portuguese accented characters (with a
 Portuguese keyboard) in MySQL monitor (MySQL command line / console
 client), when I'm in a SSH (Secure Shell) Session, in a Linux Server
 configured to use Unicode (UTF-8 encoding).

 I'm using dead keys - http://en.wikipedia.org/wiki/Dead_key - to
 enter the accented characters. That is, if I press the ã (tilde sign)
 key on my keyboard and then press a (lowercase a) then I get ã
 (lowercase a with tilde accent).

 This is a sample output from a SSH session, from a computer running
 putty version 0.60 (in Windows XP Professional with Service Pack 2)
 to my Linux Server (Suse Linux Enterprise Server 10 - aka SLES 10),
 located in the same LAN:

 # whoami
 root

 # echo Áá Ãã Çç
 Áá Ãã Çç

 [ Great... Portuguese characters seem to be working well so far, both
 in the input and in output. Now, I'll enter the mysql console: ]

 # mysql

 Welcome to the MySQL monitor.  Commands end with ; or \g.
 Your MySQL connection id is 3
 Server version: 5.0.41-community MySQL Community Edition (GPL)

 Type 'help;' or '\h' for help. Type '\c' to clear the buffer.

 [ OK... Let me try to enter one lowercase ã - a with tilde accent ]

 mysql #


 Now, you may be wondering why I'm getting that hash sign instead of
 ã (lower case a with tilde) ... I'm wondering the same thing!  ;-)

 The funny thing is that if I try to type other accented characters, in
 this mysql console, it does NOT display ANY character!


 Here's the output of \s  (status):

 mysql \s
 --
 mysql  Ver 14.12 Distrib 5.0.41, for pc-linux-gnu (i686) using readline 5.0

 Connection id:  5
 Current database:
 Current user:   [EMAIL PROTECTED]
 SSL:Not in use
 Current pager:  less
 Using outfile:  ''
 Using delimiter:;
 Server version: 5.0.41-community MySQL Community Edition (GPL)
 Protocol version:   10
 Connection: Localhost via UNIX socket
 Server characterset:latin1
 Db characterset:latin1
 Client characterset:utf8
 Conn.  characterset:utf8
 UNIX socket:/var/lib/mysql/mysql.sock
 Uptime: 1 hour 40 min 38 sec


 And here's the output of the character set variables:

 mysql show variables like 'char%';
 +--++
 | Variable_name| Value  |
 +--++
 | character_set_client | utf8

Suse Linux (SLES10), Portuguese characters and dead keys in MySQL monitor in SSH sessions with Unicode (UTF-8)

2007-07-31 Thread Ricardo Dias Marques
Hi all,

First of all, sorry for the lengthy subject, but it serves to describe
my problem:

I'm having problems entering Portuguese accented characters (with a
Portuguese keyboard) in MySQL monitor (MySQL command line / console
client), when I'm in a SSH (Secure Shell) Session, in a Linux Server
configured to use Unicode (UTF-8 encoding).

I'm using dead keys - http://en.wikipedia.org/wiki/Dead_key - to
enter the accented characters. That is, if I press the ã (tilde sign)
key on my keyboard and then press a (lowercase a) then I get ã
(lowercase a with tilde accent).

This is a sample output from a SSH session, from a computer running
putty version 0.60 (in Windows XP Professional with Service Pack 2)
to my Linux Server (Suse Linux Enterprise Server 10 - aka SLES 10),
located in the same LAN:

# whoami
root

# echo Áá Ãã Çç
Áá Ãã Çç

[ Great... Portuguese characters seem to be working well so far, both
in the input and in output. Now, I'll enter the mysql console: ]

# mysql

Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 3
Server version: 5.0.41-community MySQL Community Edition (GPL)

Type 'help;' or '\h' for help. Type '\c' to clear the buffer.

[ OK... Let me try to enter one lowercase ã - a with tilde accent ]

mysql #


Now, you may be wondering why I'm getting that hash sign instead of
ã (lower case a with tilde) ... I'm wondering the same thing!  ;-)

The funny thing is that if I try to type other accented characters, in
this mysql console, it does NOT display ANY character!


Here's the output of \s  (status):

mysql \s
--
mysql  Ver 14.12 Distrib 5.0.41, for pc-linux-gnu (i686) using readline 5.0

Connection id:  5
Current database:
Current user:   [EMAIL PROTECTED]
SSL:Not in use
Current pager:  less
Using outfile:  ''
Using delimiter:;
Server version: 5.0.41-community MySQL Community Edition (GPL)
Protocol version:   10
Connection: Localhost via UNIX socket
Server characterset:latin1
Db characterset:latin1
Client characterset:utf8
Conn.  characterset:utf8
UNIX socket:/var/lib/mysql/mysql.sock
Uptime: 1 hour 40 min 38 sec


And here's the output of the character set variables:

mysql show variables like 'char%';
+--++
| Variable_name| Value  |
+--++
| character_set_client | utf8   |
| character_set_connection | utf8   |
| character_set_database   | latin1 |
| character_set_filesystem | binary |
| character_set_results| utf8   |
| character_set_server | latin1 |
| character_set_system | utf8   |
| character_sets_dir   | /usr/share/mysql/charsets/ |
+--++
8 rows in set (0.00 sec)


I also tried to change all the character sets to utf8 by changing the
/etc/my.cnf file (by setting default-character-set=utf8 in the
[client] and [mysqld] sections of that file). That DID change all
these character_set variables to utf8, but it did NOT solve my
accented characters problem.

If I log in the to local console (the one that is PHYSICALLY connected
to the server) and I enter the mysql console, all the characters
appear correctly. But, if in that same local console, I do a ssh
127.0.0.1 (to create a ssh connection to that same machine) I get
AGAIN the same problem with the accented characters in the mysql
console (commands entered outside the mysql console DO appear
correctly).

So, I'm guessing this is NOT a problem with putty (I also tried to use
SecureCRT, also set to UTF8, with the same results), but that it is
instead some kind of missing or wrong configuration of mysql (Server
and/or Client) and/or some other variable that I must set in the SSH
daemon (sshd)  in /etc/ssh/sshd_config

By the way, this is the output of my locale command in the SSH session:

# locale
LANG=pt_PT.UTF-8
LC_CTYPE=pt_PT.UTF-8
LC_NUMERIC=pt_PT.UTF-8
LC_TIME=pt_PT.UTF-8
LC_COLLATE=POSIX
LC_MONETARY=pt_PT.UTF-8
LC_MESSAGES=pt_PT.UTF-8
LC_PAPER=pt_PT.UTF-8
LC_NAME=pt_PT.UTF-8
LC_ADDRESS=pt_PT.UTF-8
LC_TELEPHONE=pt_PT.UTF-8
LC_MEASUREMENT=pt_PT.UTF-8
LC_IDENTIFICATION=pt_PT.UTF-8
LC_ALL=


My sshd_config file DOES have the following lines, at the end:

AcceptEnv LANG LC_CTYPE LC_NUMERIC LC_TIME LC_COLLATE LC_MONETARY LC_MESSAGES
AcceptEnv LC_PAPER LC_NAME LC_ADDRESS LC_TELEPHONE LC_MEASUREMENT
AcceptEnv LC_IDENTIFICATION LC_ALL


The SSH Daemon of the Linux Server is running OpenSSH. The OpenSSH
version is OpenSSH_4.2p1, OpenSSL 0.9.8a 11 Oct 2005


Any tips or information... please?  :)

Thanks in advance!

Best wishes,
Ricardo Dias Marques
newsgroup DOT posts AT gmail DOT com

--
MySQL General Mailing List