I have this django website translating from english to german from the locale/lc_messages/django.po and django.mo files. But, when i try to translate the words which are in german letters like ü and ä, it gives me the error
'ascii' codec can't decode byte 0xc3 in position 7: ordinal not in range(128)
As far as I can think, django is trying to decode the unicode characters through ASCII which is not possible. But how do i fix this ? Where should I make the setting for django to decode through utf-8 and not through ASCII. Or let me know if I am wrong.
traceback:
DjangoUnicodeDecodeError at /de/
'ascii' codec can't decode byte 0xc3 in position 7: ordinal not in range(128). You passed in <django.utils.functional.__proxy__ object at 0x0000000005EB40B8> (<class 'django.utils.functional.__proxy__'>)
Request Method: GET
Request URL: http://127.0.0.1:8000/de/
Django Version: 1.10.1
Exception Type: DjangoUnicodeDecodeError
Exception Value:
'ascii' codec can't decode byte 0xc3 in position 7: ordinal not in range(128). You passed in <django.utils.functional.__proxy__ object at 0x0000000005EB40B8> (<class 'django.utils.functional.__proxy__'>)
Exception Location: C:\Users\deybala1\AppData\Local\Continuum\Anaconda2\lib\site-packages\django\utils\encoding.py in force_text, line 88
Python Executable: C:\Users\deybala1\AppData\Local\Continuum\Anaconda2\python.exe
Python Version: 2.7.11
Python Path:
['C:\\Users\\deybala1\\Documents\\pe-locator',
'C:\\Users\\deybala1\\AppData\\Local\\Continuum\\Anaconda2\\lib\\site-packages\\pyexcel-0.2.3-py2.7.egg',
'C:\\Users\\deybala1\\AppData\\Local\\Continuum\\Anaconda2\\lib\\site-packages\\django_registration-2.1.2-py2.7.egg',
'C:\\Users\\deybala1\\AppData\\Local\\Continuum\\Anaconda2\\lib\\site-packages\\django_http_proxy-0.4.3-py2.7.egg',
'C:\\Users\\deybala1\\AppData\\Local\\Continuum\\Anaconda2\\lib\\site-packages\\django_redis-4.4.4-py2.7.egg',
'C:\\Users\\deybala1\\AppData\\Local\\Continuum\\Anaconda2\\lib\\site-packages\\django_redis_sessions-0.5.6-py2.7.egg',
'C:\\Users\\deybala1\\AppData\\Local\\Continuum\\Anaconda2\\python27.zip',
'C:\\Users\\deybala1\\AppData\\Local\\Continuum\\Anaconda2\\DLLs',
'C:\\Users\\deybala1\\AppData\\Local\\Continuum\\Anaconda2\\lib',
'C:\\Users\\deybala1\\AppData\\Local\\Continuum\\Anaconda2\\lib\\plat-win',
'C:\\Users\\deybala1\\AppData\\Local\\Continuum\\Anaconda2\\lib\\lib-tk',
'C:\\Users\\deybala1\\AppData\\Local\\Continuum\\Anaconda2',
'c:\\users\\deybala1\\appdata\\local\\continuum\\anaconda2\\lib\\site-packages\\sphinx-1.3.5-py2.7.egg',
'c:\\users\\deybala1\\appdata\\local\\continuum\\anaconda2\\lib\\site-packages\\setuptools-20.3-py2.7.egg',
'C:\\Users\\deybala1\\AppData\\Local\\Continuum\\Anaconda2\\lib\\site-packages',
'C:\\Users\\deybala1\\AppData\\Local\\Continuum\\Anaconda2\\lib\\site-packages\\win32',
'C:\\Users\\deybala1\\AppData\\Local\\Continuum\\Anaconda2\\lib\\site-packages\\win32\\lib',
'C:\\Users\\deybala1\\AppData\\Local\\Continuum\\Anaconda2\\lib\\site-packages\\Pythonwin']
Server time: Fr, 28 Okt 2016 04:58:23 -0500
Unicode error hint
The string that could not be encoded/decoded was: ne pr��fung
This is my msgid and msgstr from django.po
#: .\app\templates\app\layout.html:47
msgid "Take Exam"
msgstr "Eine prüfung anlegen"
# coding: utf-8on first line of your file?