[reportlab-users] again russian language question

Marius Gedminas reportlab-users@reportlab.com
Mon, 26 Aug 2002 09:52:49 +0200


On Sun, Aug 25, 2002 at 06:30:50PM +0300, alienoid wrote:
> Hello reportlab-users,
> 
> I used TrueTtype font with cyrrilic support. Made as described in
> reportlab docs 'TrueType Font Support'.
> 
> String for displaying:
> 
> s = u."Here goes string in russian language in cp1251(in Windows
> Notepad)".encode('utf-8')

Try

  s = unicode("Here goes string in russian language in cp1251(in Windows Notepad)", "cp1251").encode("utf-8")

I don't think it is safe to rely on Python to guess the correct encoding
in u"XXX" literals.

Marius Gedminas
-- 
Do not meddle in the affairs of sysadmins,
they are quick to anger and have no need for subtlety.