Hey Brian, I am trying to deal with a similar situation in my app. I
would love it if someone offered a good general solution for dealing
with unexpected non-UTF-8 data in a string. There must be a way
because my web browsers can display the data without crashing! =)
The admittedly poor
If the data comes from any form in your application, you can force
encoding of form data using accept-charset attribute of form element
(see http://www.w3schools.com/tags/att_form_accept_charset.asp).
On 25 Lut, 22:17, Brian bsmcconn...@gmail.com wrote:
Hi. I have observed a sporadic Unicode
This will not work as expected, for many reasons.
The line value = unicode(value) will break with UnicodeEncodeError
(not Decode) if the value is unicode object and value contains
characters from outside ASCII range.
The line unicode(str(value).encode('string_escape')) can be
translated to