Re: UnicodeDecodeError Solution?

2010-03-19 Thread Les Smithson
Maybe feed your templates through a call to unicode.decode, with the errors arg set to 'replace'? This will replace all sequences that can't be decoded with a '?'. At least that lets you render the template. Depending on how far you want to go, you could also write your own error handler and replac

Re: UnicodeDecodeError Solution?

2010-03-19 Thread Paulo Almeida
I had a similar problem and I used two approaches. First I used Django's smart_str: from django.utils.encoding import smart_str text = smart_str(text) Then I had the same problem with fields using the csv module and I used these functions that I found on the web: def unicode_csv_reader(unicode_c

Re: UnicodeDecodeError Solution?

2010-03-19 Thread Bill Freeman
I offer my condolences. Technical solutions to political problems are seldom completely satisfactory. One possibility is that he doesn't actually get access to the templates directory, but gets read access to that directory, and write access to another directory, from which a script that he can i

UnicodeDecodeError Solution?

2010-03-19 Thread Steven L Smith
We have a freelance designer that, for various political reasons, we need to give access to our templates directory. The problem is, he frequently pastes from Microsoft Word, and other sources, and then we're seeing HTTP 500 errors because the output contains unescaped UTF-8 / unicode characters