Re: [Tutor] Unicode issues

2005-02-24 Thread Kent Johnson
Michael Lange wrote: Ok, user input must be checked whether it's unicode or not and if necessary be decoded to unicode with system encoding. For internal operations I should then use only unicode strings and if I need to print something to stdout I must encode it again with system encoding, righ

Re: [Tutor] Unicode issues

2005-02-24 Thread Michael Lange
On Thu, 24 Feb 2005 07:51:04 -0500 Kent Johnson <[EMAIL PROTECTED]> wrote: > Michael Lange wrote: > > I *thought* I would have to convert the user input which might be any > > encoding back into > > byte string first > > How are you getting the user input? Is it from the console or from a GUI?

Re: [Tutor] Unicode issues

2005-02-24 Thread Kent Johnson
Michael Lange wrote: I *thought* I would have to convert the user input which might be any encoding back into byte string first How are you getting the user input? Is it from the console or from a GUI? I think the best strategy is to try to keep all your strings as Unicode. Unicode is the only en

[Tutor] Unicode issues (was: UnicodeDecodeError)

2005-02-24 Thread Michael Lange
On Wed, 23 Feb 2005 23:16:20 -0500 Kent Johnson <[EMAIL PROTECTED]> wrote: > How about >n = self.nextfile >if not isinstance(n, unicode): > n = unicode(n, 'iso8859-1') > ? > > > At least this might explain why "A\xe4" worked and "\xe4" not as I > > mentioned in a previous post. > >