1

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.

2

you can use (fix shape file encoding)plugin in qgis 2.18 enter image description here

Choose your shapefile then set cpg file to your desired encoding

2

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).

enter image description here

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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.