开发者

How to get rid of diacriticial marks (~ from ñ, ' from á and é)?

I want to convert diacritical characters (ñ, á, é, ...) to plain characters . I would prefer a simple开发者_开发问答 regexp solution (as in: an oneliner) in JavaScript or jQuery.


Here you have a javascript solution

http://dense13.com/blog/2009/05/03/converting-string-to-slug-javascript/

Hope this helps.


You can do it in php like this:

$normalized = iconv('UTF-8', 'ASCII//TRANSLIT', $string);

For example, it will convert ñáé to nae

Hope this helps. Cheers

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜