* Szymon <[EMAIL PROTECTED]> [2008-04-30 01:43 -0700]:
>
> Hello,
>
> I have this code:
>
> foo = bar.objects.filter(status=True).extra(select={ 'litera' :
> 'LEFT(CONCAT(pseudonim, nazwisko), 1)' })
>
> and it gives me an error:
>
> 'utf8' codec can't decode byte 0xc5 in position 0: unexpected end of
> data
>
> when there is in database record starting with polish char "Ł".
Polish UTF-8 encoding consists of two bytes per character. The UTF-8
encoding for the polish character mentioned above is \xC5\x81. It seems
that somehow the second byte is lost, perhaps because of the LEFT sql
function, so when trying to decode the value in "litera", the decode finds
the first byte 0xC5 and expects to see another byte, but the second byte
is missing.
I don't know, though, why the LEFT function would return just one byte - I
would expect it to be aware to the utf-8 encoding and return the complete
utf-8 sequence (2 bytes in this case). But try to check in this direction.
Hope this helps,
Amit
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Django users" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---