开发者

Alter character set uf8 for column doesn't effect it

开发者 https://www.devze.com 2023-03-02 15:51 出处:网络
im try to alter column to utf8 but it do开发者_Go百科esn\'t effectit,it keep showing me a question mark for utf8 characters, this is the query that i run :

im try to alter column to utf8 but it do开发者_Go百科esn't effectit, it keep showing me a question mark for utf8 characters, this is the query that i run :

alter table MY_TABLE change MY_COLUMN MY_COLUMN varchar(510) character set utf8;

it only work if i change the whole table to utf8 insted to latin1, but what im trying to do is keep the table as latin1 and the column to utf8. Any idea why that query does not have effect on the column?


Mixing character sets is almost never a good idea. I would suggest either:

  • Keeping the entire table as latin1, changing the column to a binary data type like a BLOB, then using/inserting the data from the column as-is.

OR

  • Converting your entire project to utf8.

Edit:

Some of the reasons it is not a good idea to mix character sets are thus:

  • Say you were combining fields in a string concatenation function. The DBMS would most likely be confused as to what character set to use, and might try to convert UTF8 to Latin1, to quantum effects.

  • If you UNIONED a non-utf8 field with a utf8 one, again, the DBMS may become confused as to how to interpret the text. Sorting would work unexpectedly, as a UTF8 multibyte character begins with a byte outside the range of the printable latin1 character set. For instance: if you had the tuples ("d", "é", "f") [note the accent on the e], they would sort to ("d", "f", "é") if they were interpreted as latin1 strings.

0

精彩评论

暂无评论...
验证码 换一张
取 消