Lino Website

Problem reports

Test 77 failed

Tuesday, 19. September 2006 21:48.

I noticed that test 77 fails.

Traceback (most recent call last):
  File "...\tests\", line 62, in test01
  File "...\tests\", line 36, in doit
  File "...\src\lino\textprinter\", line 195, in readfile
  File "...\src\lino\textprinter\", line 253, in writeln
  File "...\src\lino\textprinter\", line 271, in writechars
  File "...\src\lino\textprinter\", line 536, in write
  File "c:\Python23\lib\encodings\", line 18, in encode
    return codecs.charmap_encode(input,errors,encoding_map)
UnicodeEncodeError: 'charmap' codec can't encode characters in position 0-69: character maps to <undefined>

This indicates imho that TextOut() does not always choose the right encoding when it gets a Unicode string. Here it obviously uses sys.getdefaultencoding(), which is cp1252 on my machine. It is normal that cp1252 cannot encode box characters. But I didn't ask for cp1252. The font returned when asking for win32con.OEM_CHARSET uses the default console codepage, which is cp850 on my machine.

How can I find out the default console codepage of a Windwos machine? How can I find out the encoding of a font?

I fixed it for now by encoding Unicode strings using sys.stdout.encoding in Win32Printer.write(), but I'm not sure this works in every case.

Copyright 2001-2007 Luc Saffre.
Generated 2007-06-07 16:22:50