Bug #60416 RTL values breaks query results table structure on mysql command line tool
Submitted: 10 Mar 2011 13:07 Modified: 10 Apr 2011 19:39
Reporter: Eyal Peleg Email Updates:
Status: No Feedback Impact on me:
None 
Category:MySQL Server: Command-line Clients Severity:S2 (Serious)
Version:5.0.51 OS:Any
Assigned to: CPU Architecture:Any

[10 Mar 2011 13:07] Eyal Peleg
Description:
if I have a query that some of the columns have hebrew (and I guess same goes for other RTL languages) values in some of the rows, the table structure gets broken.

How to repeat:
CREATE TEMPORARY TABLE T1 (
     v1 INT UNSIGNED NOT NULL DEFAULT 0,
     v2 varchar(50),
     v3 INT UNSIGNED NOT NULL DEFAULT 0
) DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci;

INSERT INTO T1 values( 1, 'english', 10);
#note that even in this script the problem exists
#the system does not know that it has to "switch back to LTR"
#at the closing apostrophe. 
INSERT INTO T1 values( 1, 'עברית', 10);

SELECT * FROM T1;

it should look like this:

+----+---------+----+
| v1 | v2      | v3 |
+----+---------+----+
|  1 | english | 10 |
|  1 | .....   | 10 |
+----+---------+----+

but with the word עברית instead of the dots

However it will look like this (assuming you managed to push the utf8 string into the table:
+----+---------+----+
| v1 | v2      | v3 |
+----+---------+----+
|  1 | english | 10 |
|  1 | עברית   | 10 |
+----+---------+----+

Suggested fix:
I was thinking that if the | char would be preceded with a "Left-To-Right Mark" character http://en.wikipedia.org/wiki/Left-to-right_mark.

It would fix things up but I have no way to test it.
i tried to use CONCAT and CHAR(226,128,142 using utf8) to simulate my proposed fix but it did not seem to work.
[10 Mar 2011 15:07] Valeriy Kravchuk
What exact version of client do you use, and on what OS?

Check with mysql --version if you are not sure, like this:

C:\Program Files\MySQL\MySQL Server 5.5\bin>mysql --version
mysql  Ver 14.14 Distrib 5.5.8, for Win32 (x86)
[10 Mar 2011 19:24] Eyal Peleg
5.0.51a-24+lenny3 (Debian)
[10 Mar 2011 19:26] Eyal Peleg
Sorry, that was the server.
client is:
mysql  Ver 14.12 Distrib 5.0.51a, for debian-linux-gnu (i486) using readline 5.2
[10 Mar 2011 19:39] Sveta Smirnova
Thank you for the feedback.

I can not repeat described behavior. Additionally version 5.0.51 is too old. Please upgrade to current version 5.0.92, try with it and if problem still exists send us output of SHOW VARIABLES LIKE '%char%' and SHOW VARIABLES LIKE '%col%'
[10 Apr 2011 23:00] Bugs System
No feedback was provided for this bug for over a month, so it is
being suspended automatically. If you are able to provide the
information that was originally requested, please do so and change
the status of the bug back to "Open".