On Sat, 2007-05-26 at 15:25 -0700, Almad wrote:
> Hello,
> 
> when displaying list of my arcitles, I'm displaying first char of my
> article as heading with {{ page.name.0 }}
> 
> However, for non-ascii characters, this char is crippled - see
> http://rpgpedia.cz/nastroje/wiki/seznam-clanku/ (bottom of the page).

You are (correctly :-( ) being served the first byte from a string of
bytes. It just happens to be half of a UTF-8 (or whetever encoding you
are using) sequence of bytes, but Python has absolutely of knowing that.

> Where should the problem be? Should this be considered as django bug?

Bytestrings are not particularly useful in cases like this, where you
want to split and join and do other string operations, so it's not
really a bug.

As Jeremy mentioned, you'll probably get more joy out of the unicode
branch, since it's much easier (and recommended) to use unicode strings
everywhere there, so you don't have to worry about encoding issues.
Slicing a unicode string as "some_unicode_string[0]" will always give
you the first character, as a unicode character -- so you don't have to
worry about how many bytes it takes up when encoded, because it's not
encoded at that point.

Regards,
Malcolm



--~--~---------~--~----~------------~-------~--~----~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to