MySQL Forums
Forum List  »  MySQL Shell

Mysqlsh encoding output
Posted by: Luis Mendoza
Date: January 11, 2023 03:21AM

Hello,

I'm working with 8.0.23-commercial for Linux on x86_64.

I work with a database containing tables that use the latin1 CHARACTER SET. This causes queries' output to be strangely encoded, specifically non ASCII characters (i.e. 'é').

Consider the following example :


CREATE TABLE `my_test_table` ( `idx_table` bigint(10) unsigned NOT NULL,`myColumn` enum('autorisé','bloqué') DEFAULT NULL, PRIMARY KEY (`idx_table`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 COMMENT='My comment contains é à and other non ASCII characters';

If I insert into this table via mysqlsh :
INSERT INTO my_test_table VALUES(0,'autorisé');
it works as expected.

However while using any data already inserted in my database :
INSERT INTO my_test_table SELECT idx_old_table, old_column from old_table limit 1;
I get "Warning (code 1265): Data truncated for column 'myColumn' at row 1"

The same goes for reading data already inserted in to already existing tables :
SELECT idx_old_table, old_column FROM old_table;
would ouptu something like this :
{
"idx_old_table": 421879389,
"old_column": "autoris▒e"
}

How can I go about working with a database like this with mysqlsh command prompt? Why does mysqlsh encodes differently both latin1 character sets?

Addendum, I tried hexing the output of my old table and then rencoding the result as latin1 and it does give me an accented correct version, so the data in my table is correct.

PS: does this forum use any syntax hilighting supporting format?

Options: ReplyQuote


Subject
Views
Written By
Posted
Mysqlsh encoding output
496
January 11, 2023 03:21AM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.