Share on Facebook Share on Twitter

PHP convert accented characters to ascii. Convert UTF8 to ASCII. PHP function to convert national chars into their latin equivalents. For example, convert “Biên Thùy” to “Bien Thuy” or “Höhle” to Hohle. This is usefull function when you want to have friendly url…
So, this is PHP function to replaces special characters in a string with their “non-special” counterpart.

This PHP file must be saved in UTF-8 encoding.

An other version using UTF-8 code for JavaScript as below:

Remove vietnamese accent javascript / Bỏ dấu tiếng Việt

Actually, removing accents should be processed on server side to make sure your content is rendered properly before display to user.

The function above will also replace all Vietnamese accented characters with non-accented characters.
The PHP convert accented characters to ascii function above also use to remove Vietnamese accent in URL.

WordPress core also include a function called remove_accents. It’s located inside this file: wp-includes/formatting.php
You can use it as follow:


Example Converting standard Vietnamese Characters to non-accent ones:


Chao mung cac ban ghe tham website cua Bien Thuy. Chuc cac ban vui ve

Last updated on August 26th, 2020 at 06:20 am


What do you think?

This website is using cookies. More info. That's Fine