From 35cd58545a8f2b6d2049fad1dd0c7fc8fc9b25ae Mon Sep 17 00:00:00 2001 From: Mika Bostrom Date: Wed, 12 Aug 2009 08:26:06 +0300 Subject: [PATCH] More generic locale use, I hope Instead of assuming conversion is from latin1, use locale information --- pyfpdb/fpdb_simple.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/pyfpdb/fpdb_simple.py b/pyfpdb/fpdb_simple.py index d91becb8..781ef290 100644 --- a/pyfpdb/fpdb_simple.py +++ b/pyfpdb/fpdb_simple.py @@ -25,6 +25,7 @@ import datetime import time import re import sys +import locale import Card @@ -37,6 +38,8 @@ MYSQL_INNODB = 2 PGSQL = 3 SQLITE = 4 +(localename, encoding) = locale.getdefaultlocale() + class DuplicateError(Exception): def __init__(self, value): self.value = value @@ -704,7 +707,7 @@ def parseHandStartTime(topline): def findName(line): pos1 = line.find(":") + 2 pos2 = line.rfind("(") - 1 - return unicode(line[pos1:pos2], "latin-1") + return unicode(line[pos1:pos2], encoding) def parseNames(lines): return [findName(line) for line in lines]