> > from easygui import easygui
> > raw = unicode("121ø 55' 5.55''", 'utf-8')
> > => gets a encoding error
> 
> Then your source file is not really in UTF-8.
This really helped!

 
> Get an editor on Windows that can edit UTF-8 text files and file 
> transfer software that doesn't change the text encoding. Work with UTF-8 
> exclusively.
Thanks. This sounds really trivial but the thing is that one cannot define file
encoding in PythonWin.
I will have to either use a advanced editor like Notepad++ and run the script
via console or use Geany as IDE.

Since it didn't work in IPython as well I assume that I need to change the
encoding of the IPython shell to UTF-8, too. Still need to find out where.

The following code works on windows when saved to a UTF-8 encoded file:

# -*- coding: utf-8 -*-
# the file needs to be set to UTF-8 encoding if working on windows
from easygui import easygui
raw = unicode("125° 15' 5.55''", 'utf-8')
print raw.encode('utf-8')
lines = raw.split(unicode('°', 'utf-8'))
print lines
entertext = easygui.enterbox(message="Enter something.", title="",  
argDefaultText=raw)
print entertext
degrees = lines[0]
print "degrees: ", str(degrees)

Thanks for your support, so far.
Timmie


_______________________________________________
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor

Reply via email to