On Sun, May 31, 2009 at 6:24 AM, Vlad(L) <referma...@yandex.ru> wrote:
> > The second day I fight, I can not troubleshoot. I wish to output in > django blog page, and to me produces UnicodeDecodeError. > I have filled a blog with the Russian text, and was English probably > error would not be. Here an error code: > > > Environment: > > Request Method: GET > Request URL: http://127.0.0.1:8000/blog/ > Django Version: 1.0.2 final > Python Version: 2.5.4 > Installed Applications: > ['django.contrib.auth', > 'django.contrib.contenttypes', > 'django.contrib.sessions', > 'django.contrib.sites', > 'mysite.blog', > 'django.contrib.admin'] > Installed Middleware: > ('django.middleware.common.CommonMiddleware', > 'django.contrib.sessions.middleware.SessionMiddleware', > 'django.contrib.auth.middleware.AuthenticationMiddleware') > > > Traceback: > File "C:\Python25\lib\site-packages\django\core\handlers\base.py" in > get_response > 86. response = callback(request, *callback_args, > **callback_kwargs) > File "C:\mysite\..\mysite\blog\views.py" in archive > 10. t = loader.get_template("archive.html") > File "C:\Python25\lib\site-packages\django\template\loader.py" in > get_template > 80. source, origin = find_template_source(template_name) > File "C:\Python25\lib\site-packages\django\template\loader.py" in > find_template_source > 69. source, display_name = loader(name, dirs) > File "C:\Python25\lib\site-packages\django\template\loaders > \app_directories.py" in load_template_source > 58. return (open(filepath).read().decode > (settings.FILE_CHARSET), filepath) > File "C:\Python25\lib\encodings\utf_8.py" in decode > 16. return codecs.utf_8_decode(input, errors, True) > > Exception Type: UnicodeDecodeError at /blog/ > Exception Value: 'utf8' codec can't decode bytes in position 28-29: > invalid data > > > > The coding in MySQL utf8... In the file beginning views.py to register > #-* - encoding: utf-8-* - - all is useless >From the traceback, the file it is having trouble reading is a template file. So the problem is not with the database data nor the Python source, but your template file: it cannot be decoded by the utf-8 decoder. Apparently the template file you are trying to use here is not using utf-8 encoding. Either change it to be utf-8 encoded, or, if you are consistently using some other encoding for all your template files you might try changing FILE_CHARSET in settings.py to be whatever encoding you are actually using. Karen --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~----------~----~----~----~------~----~------~--~---