Bug 3180

Summary: dogtail crashes with a UnicodeDecodeError: "'utf8' codec can't decode byte ..." error when running example
Product: frysk Reporter: Andrew Cagney <cagney>
Component: generalAssignee: Unassigned <frysk-bugzilla>
Status: NEW ---    
Severity: normal    
Priority: P3    
Version: unspecified   
Target Milestone: ---   
Host: Target:
Build: Last reconfirmed:
Bug Depends on:    
Bug Blocks: 2777    

Description Andrew Cagney 2006-09-06 21:03:28 UTC
From: http://bugzilla.gnome.org/show_bug.cgi?id=354515

Opened by Phil Muldoon (reporter, points: 3)
2006-09-05 20:53 UTC [reply]

Steps to reproduce:
1. Fedora Rawhide
2. python gedit-test-utf8-procedural-api.py

Stack trace:
[pmuldoon@dhcp-199 examples]$ python gedit-test-utf8-procedural-api.py 
Creating logfile at
/tmp/dogtail/logs/gedit-test-utf8-procedural-api_20060905-155027 ...
Detecting distribution: Red Hat/Fedora/derived distribution
GTK Accessibility Module initialized
Bonobo accessibility support initialized
Traceback (most recent call last):
  File "gedit-test-utf8-procedural-api.py", line 30, in ?
  File "/usr/lib/python2.4/site-packages/dogtail/procedural.py", line 310, in
  File "/usr/lib/python2.4/site-packages/dogtail/procedural.py", line 57, in
    app = self.desktop.findChild(predicate, recursive = False, retry = False)
  File "/usr/lib/python2.4/site-packages/dogtail/tree.py", line 845, in
    result = findFirstChildSatisfying(self, pred, recursive)
  File "/usr/lib/python2.4/site-packages/dogtail/tree.py", line 817, in
    if child.satisfies(pred):
  File "/usr/lib/python2.4/site-packages/dogtail/tree.py", line 685, in
    return pred.satisfiedByNode(self)
  File "/usr/lib/python2.4/site-packages/dogtail/predicate.py", line 95, in
    return node.roleName=='application' and stringMatches(self.appName,
  File "/usr/lib/python2.4/site-packages/dogtail/predicate.py", line 13, in
    return scriptName.matchedBy(reportedName)
  File "/usr/lib/python2.4/site-packages/dogtail/i18n.py", line 160, in
    return stringsMatch(self.untranslatedString, string)
  File "/usr/lib/python2.4/site-packages/dogtail/i18n.py", line 140, in
    outString = outString.decode('utf-8')
  File "/usr/lib/python2.4/encodings/utf_8.py", line 16, in decode
    return codecs.utf_8_decode(input, errors, True)
UnicodeDecodeError: 'utf8' codec can't decode byte 0xa8 in position 0:
unexpected code byte

Other information:
We first noticed this when the frysk dogtail test suite crashed on rawhide:

The offending code (tree.root.application ....)

   # Start up Frysk 
    run ( FryskBinary, appName=FRYSK_APP_NAME )
    fryskObject = tree.root.application ( FRYSK_APP_NAME )

Crashed at that point. Checked sanity of FRYSK_APP_NAME turns out fine. However
using the AT-SPI sniff tool in the Programming -> AT_SPI Browser menu reveals
some applications with some odd names. One was named ?#? and others. I can
affix a screenshot if you need it. Sanity checked with the examples. It seems
when dogtail walks the tree, badly encoded strings cause it to crash.
Comment 1 Andrew Cagney 2006-09-06 21:04:58 UTC
Red Hat tracker: