getattr/setattr still ASCII-only, not Unicode - blows up SGMLlib from BeautifulSoup

John Nagle nagle at
Thu Mar 13 19:38:37 CET 2008

   Just noticed, again, that getattr/setattr are ASCII-only, and don't support

   SGMLlib blows up because of this when faced with a Unicode end tag:

	File "/usr/local/lib/python2.5/", line 353, in finish_endtag
	method = getattr(self, 'end_' + tag)
	UnicodeEncodeError: 'ascii' codec can't encode character u'\xae'
	in position 46: ordinal not in range(128)

Should attributes be restricted to ASCII, or is this a bug?

					John Nagle

More information about the Python-list mailing list