I am using django_countries
module for countries list, the problem is there are couple of countries with special characters like 'Åland Islands'
and 'Saint Barthélemy'
.
I am calling this method to get the country name:
country_label = fields.Country(form.cleaned_data.get('country')[0:2]).name
I know that country_label is lazy translated proxy object of django utils, but it is not giving the right name rather it gives 'Ã…land Islands'
. any suggestions for this please?
Just this this week I encountered a similar encoding error. I believe the problem is because the machine encoding is differ with the one on Python. Try to add this to your
.bashrc
or.zshrc
.Then, open up a new terminal and run the Django app again.