japanese encoding iso-2022-jp in python vs. perl

"Martin v. Löwis" martin at v.loewis.de
Tue Oct 23 20:57:30 CEST 2007


>  var = var.encode("iso-2022-jp", "replace")
>  print var
[...]
> ↓東京メトロ日比谷線・北千住行
> 
> So, what's the deal?  Why can't python properly encode some of these
> characters?

It's not clear. As Ryan says, it works just fine (and so it does for
me with Python 2.4.4 on Debian).

What Python version are you using, and what is the precise string that
you want to encode? (use "print repr(var)" to report that exact value)

HTH,
Martin



More information about the Python-list mailing list