[Tutor] more encoding confusion

Kent Johnson kent37 at tds.net
Sun Aug 5 20:37:01 CEST 2007


Jon Crump wrote:
> 
> Kent, Many thanks again, and thanks too to Paul at 
> http://tinyurl.com/yrl8cy.
> 
> That's very effective, thanks very much for the detailed explanation; 
> however, I'm a little surprised that it's necessary. I would have 
> thought that there would be some standard module that included a unicode 
> equivalent of the builtin method isupper().

Hmm...actually, isupper() works fine on unicode strings:
In [18]: s='H\303\211RON'.decode('utf-8')
In [21]: print 'H\303\211RON'
HÉRON
In [22]: s.isupper()
Out[22]: True

:-)


> I modified uppers to include only the latin characters, and added the 
> apostrophe to catch placenames like L'ISLE.

Then you are back to needing a regular expression I think.

Kent

PS Please use Reply All to reply on-list.


More information about the Tutor mailing list