string.encode on HP-UX

Richard Townsend richardt at edshk.demon.co.uk
Wed Jul 21 06:48:04 EDT 2004


Using Python-2.3.4 on HP-UX11i, the following code:

  import locale
  loc = locale.setlocale(locale.LC_ALL)
  print 'locale =', loc
  loc = locale.nl_langinfo(locale.CODESET)
  print 'locale =', loc
  print 'hello'.encode(loc, 'replace')

produces:

  locale = C C C C C C
  locale = roman8
  Traceback (most recent call last):
    File "test_locale.py", line 13, in ?
      print 'hello'.encode(loc, 'replace')
  LookupError: unknown encoding: roman8


[The same code on SUSE 9.1 doesn't raise an exception].

Should I be able to pass the value returned by nl_langinfo() to the
string.encode call?

Similar code is used by wxGlade and this exception prevents it from
running. 

Does anybody know how to fix this on HP-UX?

-- 
Richard Townsend



More information about the Python-list mailing list