mysql替换重音字符 [英] mysql replace accented characters

查看:233
本文介绍了mysql替换重音字符的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想从用户的名字和姓氏生成严格的字母数字字符登录。因为他们中许多是外国人,他们的名字有特殊字符(é,è,ï,...)。我想删除登录中的口音(e,e,i,...)。

i would like to generate strict alphanumeric character logins from users' first and lastname. Since many of them are foreigners, their names have special characters (é, è, ï, ...). I would like to remove the accents (e,e,i,...) in the logins.

这里是我的查询。是否有不包含重音符的字符集?

Here is my query. Is there a character set that does not contain accents?

UPDATE contacts SET login=CONVERT(LOWER(CONCAT(firstname,'.',lastname)) USING utf8);


推荐答案

那么,作为法国的计算机科学家

Well, as a French computer scientist (with an accent in his name), I would strongly advocate against such a conversion.

为什么,好吧,因为这个策略只是用另一个错误的假设来替换一个错误的假设。让我自己解释一下:

Why, well, because this strategy is just replacing a wrong assumption with another wrong assumption. Let me explain myself:

我们可以看到,只有us-ascii被允许在登录ID中作为一个错误的假设,所有用户名可以 in ascii。

We could see the fact that only us-ascii are allowed in login id as an incorrect assumption that "all user names can be written in ascii".

尝试从用户名中删除重音符只是替换了所有用户名可以到ascii。

Trying to remove accents from users name is just replacing the assumption by "all user names can be converted to ascii".

这也是不正确的:它会为我工作(作为一个欧洲 - 拉丁语1证明命名的人),但你如何计算三岛的名字?或Сахаров?

That is also incorrect: It will work for me (as a European - Latin 1 proof named person), but how will you compute the name of 三島 ? or the one of Сахаров ?

我知道我的答案是非技术性的,但你应该做任何必要的,以允许非ascii字符登录。或者,您应该允许您的用户选择此登录。

I know my answer is non technical, but you should do whatever is necessary to allow non ascii chars in logins. Or, you should allow your users to choose this login.

这篇关于mysql替换重音字符的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆