What's the data source encoding to use in QGIS to delete the Vietnamese accents?
I want to get my data in the attribute table from Bình Chánh to Bing Chanh.
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It only takes a minute to sign up.
Sign up to join this communityWhat's the data source encoding to use in QGIS to delete the Vietnamese accents?
I want to get my data in the attribute table from Bình Chánh to Bing Chanh.
Because in my native language there are some special characters, I've already did something similar some time ago.
What I didn't know, when I started answering your question, was that adapting my previous code for the Vietnamese letters will take some time, because of the huge number of special characters with diacritics (read more about the Vietnamese alphabet on Wikipedia). That's why answering your question was very instructive for me.
To quickly resolve your issue, regardless of the QGIS version and encoding, I suggest you to open your layer attribute table, then copy the following code (using your existing field name!)
regexp_replace( regexp_replace( regexp_replace(
regexp_replace( regexp_replace( regexp_replace(
regexp_replace( regexp_replace( regexp_replace(
regexp_replace( regexp_replace( regexp_replace(
regexp_replace( regexp_replace( "YourFieldName" ,
'[ạâẩăẳặầấãáàåäả]' , 'a' ) ,
'[ẠÂẨĂẲẶẦẤÃÁÀÅÄẢ]' , 'A' ) ,
'[đ]' , 'd' ) ,
'[Đ]' , 'D' ) ,
'[êệểễếẽề]', 'e' ) ,
'[ÊỆỂỄẾẼỀ]', 'E' ) ,
'[ịíìĩ]' , 'i' ) ,
'[ỊÍÌĨ]' , 'I' ) ,
'[ổôộơớỏồốỡợớóòờọờ]' , 'o' ) ,
'[ỔÔỘƠỚỎỒỐỠỢỚÓÒỜỌỜ]' , 'O' ) ,
'[ùứừúủưựữũ]' , 'u' ) ,
'[ÙỨỪÚỦƯỰỮŨ]' , 'U' ) ,
'[ý]' , 'y' ) ,
'[Ý]' , 'Y' )
and paste it into the Field Calculator (as in the picture below).
Just take a look at the oputput preview!
I can not guarantee that I've identified absolutely all the Vietnamese special characters, but the code is easy modifiable in case you'll find out some omitted character.