wmlscope: open files as UTF-8 and use Unicode literals
This commit is contained in:
parent
501b3aa2d9
commit
ab88b9091f
1 changed files with 4 additions and 4 deletions
|
@ -92,9 +92,9 @@
|
|||
#
|
||||
# sets the warning level.
|
||||
|
||||
from __future__ import print_function
|
||||
from __future__ import print_function, unicode_literals
|
||||
|
||||
import sys, os, time, re, getopt, hashlib, glob
|
||||
import sys, os, time, re, getopt, hashlib, glob, codecs
|
||||
from wesnoth.wmltools import *
|
||||
|
||||
def interpret(lines, css):
|
||||
|
@ -288,7 +288,7 @@ class CrossRefLister(CrossRef):
|
|||
outstr += "<h1 id='file:" + displayname + "' class='file_header'>From file: " + displayname + "</h1>\n"
|
||||
filenamelist.append(displayname)
|
||||
hdr = []
|
||||
with open(filename) as dfp:
|
||||
with codecs.open(filename, "r", "utf8") as dfp:
|
||||
for line in dfp:
|
||||
line = line.lstrip()
|
||||
if line and line.startswith("#textdomain"):
|
||||
|
@ -445,7 +445,7 @@ Usage: wmlscope [options] dirpath
|
|||
if collisions:
|
||||
collisions = []
|
||||
for (namespace, filename) in xref.filelist.generator():
|
||||
with open(filename) as ifp:
|
||||
with codecs.open(filename, "r", "utf8") as ifp:
|
||||
collisions.append(hashlib.md5(ifp.read()).digest())
|
||||
collisions = zip(xref.filelist.flatten(), collisions)
|
||||
hashcounts = {}
|
||||
|
|
Loading…
Add table
Reference in a new issue