开发者

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

开发者 https://www.devze.com 2023-03-17 02:14 出处:网络
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 jav

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

精彩评论

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