diff --git a/pyfpdb/Tables.py b/pyfpdb/Tables.py index 97a897ca..9fdc8630 100755 --- a/pyfpdb/Tables.py +++ b/pyfpdb/Tables.py @@ -230,11 +230,20 @@ def discover_nt_by_name(c, tablename): """Finds poker client window with the given table name.""" titles = {} win32gui.EnumWindows(win_enum_handler, titles) + + def getDefaultEncoding(): + # FIXME: if somebody know better place fot this function - move it + # FIXME: it's better to use GetCPInfo for windows http://msdn.microsoft.com/en-us/library/dd318078(VS.85).aspx + # but i have no idea, how to call it + import locale + return locale.getpreferredencoding() + for hwnd in titles: #print "Tables.py: tablename =", tablename, "title =", titles[hwnd] try: + # maybe it's better to make global titles[hwnd] decoding? # this can blow up in XP on some windows, eg firefox displaying http://docs.python.org/tutorial/classes.html - if not tablename.lower() in titles[hwnd].lower(): continue + if not tablename.lower() in titles[hwnd].decode(getDefaultEncoding()).lower(): continue except: continue if 'History for table:' in titles[hwnd]: continue # Everleaf Network HH viewer window