Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Chinese sorting problem of character set utf8

2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

Shulou(Shulou.com)06/01 Report--

Database

Character set: utf8

Collation: utf8_generay_ci

Table structure:

Mysql > desc chr

+-+ +

| | Field | Type | Null | Key | Default | Extra | |

+-+ +

| | char_1 | char (255) | YES | | NULL |

| | bin | varbinary (20) | YES | | NULL |

| | name | varchar (50) | YES | | NULL |

| | static_bin | binary (30) | YES | | NULL |

+-+ +

Chinese sorting will be out of order:

Mysql > select * from chr order by name

+-+

| | char_1 | bin | name | static_bin | |

+-+

| | No |

| | he |

| | send Safin |

| | Ah |

| | A |

| | Uh, hungry |

+-+

6 rows in set (0.01 sec

Mysql > select * From chr order by convert (name using 'gbk') collate' gbk_chinese_ci'

->

+-+

| | char_1 | bin | name | static_bin | |

+-+

| | A |

| | Ah |

| | No |

| | Uh, hungry |

| | send Safin |

| | he |

+-+

6 rows in set (0.00 sec)

Mysql >

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Database

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report