I'm still working through the documentation on this one, but I found a slightly odd case. <br><br>-----<br>#!/usr/bin/python<br><br>from twill import get_browser<br>from twill.commands import debug, go, follow, back, find, showforms
<br><br>url = "<a href="http://swordstyle.com/test/index.php">http://swordstyle.com/test/index.php</a>"<br><br>b = get_browser()<br><br>b.go(url)<br><br>showforms()<br>-----<br><br>This ends up throwing a unexpected response:
<br><br>-----<br>Traceback (most recent call last):<br> File "test_unicode.py", line 13, in ?<br> showforms()<br> File "/Library/Python/2.3/site-packages/twill-0.8.3-py2.3.egg/twill/commands.py", line 326, in showforms
<br> browser.showforms()<br> File "/Library/Python/2.3/site-packages/twill-0.8.3-py2.3.egg/twill/browser.py", line 223, in showforms<br> for n, f in enumerate(self._browser.forms()):<br> File "/Library/Python/2.3/site-packages/twill-
0.8.3-py2.3.egg/twill/other_packages/mechanize/_mechanize.py", line 244, in forms<br> return self._factory.forms()<br> File "/Library/Python/2.3/site-packages/twill-0.8.3-py2.3.egg/twill/utils.py", line 307, in forms
<br> self._forms = parse_fn(response, self._encoding)<br> File "/Library/Python/2.3/site-packages/twill-0.8.3-py2.3.egg/twill/other_packages/mechanize/_html.py", line 218, in parse_response<br> ignore_errors=
self.ignore_errors<br> File "/Library/Python/2.3/site-packages/twill-0.8.3-py2.3.egg/twill/other_packages/ClientForm.py", line 870, in ParseResponse<br> encoding,<br> File "/Library/Python/2.3/site-packages/twill-
0.8.3-py2.3.egg/twill/other_packages/ClientForm.py", line 906, in ParseFile<br> fp.feed(ch)<br> File "/System/Library/Frameworks/Python.framework/Versions/2.3/lib/python2.3/sgmllib.py", line 95, in feed
<br> self.goahead(0)<br> File "/System/Library/Frameworks/Python.framework/Versions/2.3/lib/python2.3/sgmllib.py", line 184, in goahead<br> self.handle_entityref(name)<br> File "/Library/Python/2.3/site-packages/twill-
0.8.3-py2.3.egg/twill/other_packages/ClientForm.py", line 667, in handle_entityref<br> self.handle_data(table[fullname].encode(self._encoding))<br>UnicodeEncodeError: 'latin-1' codec can't encode character u'\u2122' in position 0: ordinal not in range(256)
<br>-----<br><br>Has anyone else run into this problem?<br><br>