projects
/
treecutter.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
bcd05d7
)
include; table - better character support
author
Fred
<fred@ash.tree.se>
Mon, 13 Feb 2017 20:07:28 +0000
(21:07 +0100)
committer
Fred
<fred@ash.tree.se>
Mon, 13 Feb 2017 20:07:28 +0000
(21:07 +0100)
adding codecs to table parsing, enabling utf-8 support
xinclude/table.py
patch
|
blob
|
history
diff --git
a/xinclude/table.py
b/xinclude/table.py
index f3386617060b15fe1006a00a1472c624da79b895..ab6642717fcdf4bda3004c7ac6a32aaf09a78d5f 100755
(executable)
--- a/
xinclude/table.py
+++ b/
xinclude/table.py
@@
-3,6
+3,7
@@
import sys
import re
+import codecs
from urlparse import urlparse
from lxml import etree
@@
-24,9
+25,9
@@
class Table(object):
self.cols = []
def parse(self):
- f =
file(self.tablefile, 'r
')
+ f =
codecs.open(self.tablefile, encoding='utf-8
')
for line in f:
- c =
line.split(
)
+ c =
re.split(r'\t+', line.rstrip()
)
self.cols.append(c)
def db_xml(self):