milluhgram / autokey

Automatically exported from code.google.com/p/autokey
GNU General Public License v3.0
0 stars 0 forks source link

UnicodeDecodeError in window.get_active_geometry() when any window title contains non-ascii characters #247

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1. Create a window with a non-ascii character in the title bar
   - For example, point a browser at http://en.wikipedia.org/wiki/%C3%9C
   - Skype for Linux puts a trademark symbol in its window title
2. Call window.get_active_geometry()

What is the expected output? What do you see instead?

I expected to get the geometry of the active window. Instead, I get the 
following traceback:

Traceback (most recent call last):
  File "/usr/lib/python2.7/dist-packages/autokey/service.py", line 454, in execute
    exec script.code in scope
  File "<string>", line 18, in <module>
  File "/usr/lib/python2.7/dist-packages/autokey/scripting.py", line 1060, in get_active_geometry
    if active in line[34:].split(' ', 1)[-1]:
UnicodeDecodeError: 'ascii' codec can't decode byte 0xe2 in position 22: 
ordinal not in range(128)

What version of the product are you using? On what operating system?

autokey-gtk 0.90.1 on Ubuntu 13.04

Original issue reported on code.google.com by paulhooi...@gmail.com on 5 Jul 2013 at 11:58

GoogleCodeExporter commented 8 years ago
Confirmed for me as well on Linux Mint 15 Olivia 

Original comment by JBaldach...@gmail.com on 23 Jul 2013 at 11:50

GoogleCodeExporter commented 8 years ago
Still having the issue in 0.90.4 as well on Ubuntu 14.10.

Original comment by Overmind...@gmail.com on 14 Sep 2014 at 2:31

GoogleCodeExporter commented 8 years ago
For note, found a temporary fix, just add this to the top of any script with 
this issue:

import sys reload(sys) sys.setdefaultencoding('utf-8')

Original comment by Overmind...@gmail.com on 14 Sep 2014 at 3:06