用其表音相似字符替换特殊字符(在 php - utf8 中)
您知道有很多字符,例如 è 或 é。还有更多,比如 ö,ä,ì,á,ù,...
我想用它的“pheneticpartner”字符替换这些字符,但我不想像
str_replace(array("á", "à", "é", "è", ...), array("a", "a", "e", "e", ...), &$input);
那里 那样对每个字符都这样做任何常见的方式来做这样的事情:
str_replace_phoenetical(&$input)
- 还有人写剧本吗 涵盖所有情况?
- 有没有办法自动 检测这些字符,然后 删除`或'?
到目前为止谢谢
更新:
有人推荐这个(在 php.net 上找到)?
you know that there are many characters like è or é. There are many more, like ö,ä,ì,á,ù,...
i want to replace those characters with its "phoenetic partner"-character, but i don't want to do it for each single character like
str_replace(array("á", "à", "é", "è", ...), array("a", "a", "e", "e", ...), &$input);
is there any common way to do something like:
str_replace_phoenetical(&$input)
- has anybody still wirtten a script
which covers all cases? - is there a way to automaticly
detect those characters and just
remove the ` or '?
thanks so far
UPDATE:
does anyone reccomands this one (found on php.net)?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您可以使用
iconv()
音译它们。Ideone。
You can transliterate them with
iconv()
.Ideone.
unidecode
unidecode