diacritics

Remove accents/diacritics in a string in JavaScript

浪尽此生 提交于 2019-11-25 22:24:33
问题 How do I remove accentuated characters from a string? Especially in IE6, I had something like this: accentsTidy = function(s){ var r=s.toLowerCase(); r = r.replace(new RegExp(/\\s/g),\"\"); r = r.replace(new RegExp(/[àáâãäå]/g),\"a\"); r = r.replace(new RegExp(/æ/g),\"ae\"); r = r.replace(new RegExp(/ç/g),\"c\"); r = r.replace(new RegExp(/[èéêë]/g),\"e\"); r = r.replace(new RegExp(/[ìíîï]/g),\"i\"); r = r.replace(new RegExp(/ñ/g),\"n\"); r = r.replace(new RegExp(/[òóôõö]/g),\"o\"); r = r

What is the best way to remove accents in a Python unicode string?

大憨熊 提交于 2019-11-25 21:48:02
问题 I have a Unicode string in Python, and I would like to remove all the accents (diacritics). I found on the Web an elegant way to do this in Java: convert the Unicode string to its long normalized form (with a separate character for letters and diacritics) remove all the characters whose Unicode type is \"diacritic\". Do I need to install a library such as pyICU or is this possible with just the python standard library? And what about python 3? Important note: I would like to avoid code with