I'm hopping someone an give me a clue about how to handle this problem.
I've got an application that gets data from a database and basically
feeds the data to another program via json. I just started getting this
error:
<type 'exceptions.UnicodeDecodeError'>: 'utf8' codec can't decode byte
0x92 in position 247: unexpected code byte
I think that means that I've got some kind of funky code (I don't know
what 0x92 would be) in my database. Does anyone know how to get around
this?
Thanks in advance for any and all help
Jose
>>> import unicodedata
>>> unicodedata.name(unicode('\x92', 'cp1252'))
'RIGHT SINGLE QUOTATION MARK'
>>> print unicode('\x92', 'cp1252')
'
> I think that means that I've got some kind of funky code (I don't know
> what 0x92 would be) in my database. Does anyone know how to get around
> this?
>
> Thanks in advance for any and all help
> Jose
>
> >
>
--
Saludos,
--
Luis Miguel
So if I get the code below, unicodedata.name will tell me what the
character actually is, so how do I fix it so that I can actually print
it? Right now I'm trying to replace \x92 with ' but that looks
fragile. Does anyone know if there is a more generic way of doing this?
Jose
Yes, you must configure your app. Do you understand unicode? Read
http://www.amk.ca/python/howto/unicode or
http://effbot.org/zone/unicode-objects.htm.
> Luis Miguel Morillas wrote:
> > 2007/3/24, Jose Galvez <jj.g...@gmail.com>:
> >
> >> Hi all,
> >>
> >> I'm hopping someone an give me a clue about how to handle this problem.
> >> I've got an application that gets data from a database and basically
> >> feeds the data to another program via json. I just started getting this
> >> error:
> >>
> >> <type 'exceptions.UnicodeDecodeError'>: 'utf8' codec can't decode byte
> >> 0x92 in position 247: unexpected code byte
> >>
> >>
> > Are you on windows?
> >
> >
> >>>> import unicodedata
> >>>> unicodedata.name(unicode('\x92', 'cp1252'))
> >>>>
> > 'RIGHT SINGLE QUOTATION MARK'
> >
> >
> >>>> print unicode('\x92', 'cp1252')
> >>>>
> > '
> >
> >
> >> I think that means that I've got some kind of funky code (I don't know
> >> what 0x92 would be) in my database. Does anyone know how to get around
> >> this?
> >>
> >> Thanks in advance for any and all help
> >> Jose
> >>
> >>
> >
> >
> >
>
>
> >
>