More generic locale use, I hope
Instead of assuming conversion is from latin1, use locale information
This commit is contained in:
parent
b1281385ec
commit
35cd58545a
|
@ -25,6 +25,7 @@ import datetime
|
||||||
import time
|
import time
|
||||||
import re
|
import re
|
||||||
import sys
|
import sys
|
||||||
|
import locale
|
||||||
|
|
||||||
import Card
|
import Card
|
||||||
|
|
||||||
|
@ -37,6 +38,8 @@ MYSQL_INNODB = 2
|
||||||
PGSQL = 3
|
PGSQL = 3
|
||||||
SQLITE = 4
|
SQLITE = 4
|
||||||
|
|
||||||
|
(localename, encoding) = locale.getdefaultlocale()
|
||||||
|
|
||||||
class DuplicateError(Exception):
|
class DuplicateError(Exception):
|
||||||
def __init__(self, value):
|
def __init__(self, value):
|
||||||
self.value = value
|
self.value = value
|
||||||
|
@ -704,7 +707,7 @@ def parseHandStartTime(topline):
|
||||||
def findName(line):
|
def findName(line):
|
||||||
pos1 = line.find(":") + 2
|
pos1 = line.find(":") + 2
|
||||||
pos2 = line.rfind("(") - 1
|
pos2 = line.rfind("(") - 1
|
||||||
return unicode(line[pos1:pos2], "latin-1")
|
return unicode(line[pos1:pos2], encoding)
|
||||||
|
|
||||||
def parseNames(lines):
|
def parseNames(lines):
|
||||||
return [findName(line) for line in lines]
|
return [findName(line) for line in lines]
|
||||||
|
|
Loading…
Reference in New Issue
Block a user