Skip to content

Commit 2bc9092

Browse files
committed
etc: use codecs in featureck
this asserts that source is valid utf8
1 parent d1082aa commit 2bc9092

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

src/etc/featureck.py

+5-2
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,10 @@
1818
# since the same version
1919
# * Prints information about features
2020

21-
import sys, os, re
21+
import sys
22+
import os
23+
import re
24+
import codecs
2225

2326
if len(sys.argv) < 2:
2427
print("usage: featureck.py <src-dir>")
@@ -79,7 +82,7 @@
7982
continue
8083

8184
if sys.version_info.major == 2:
82-
_open = lambda f: open(f, 'r')
85+
_open = lambda f: codecs.open(filename=f, mode='r', encoding="utf-8")
8386
elif sys.version_info.major == 3:
8487
_open = lambda f: open(f, 'r', encoding="utf-8")
8588
else:

0 commit comments

Comments
 (0)