More generic locale use, I hope

Instead of assuming conversion is from latin1, use locale information
This commit is contained in:
Mika Bostrom 2009-08-12 08:26:06 +03:00
parent b1281385ec
commit 35cd58545a

View File

@ -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]