[6.1] eac1bd580 Add a crude python2/python3 hack to deal with UTF-8
hermunn
hermunn at varnish-software.com
Wed Oct 24 09:29:22 UTC 2018
commit eac1bd580ec08b4e3ef1fae8594ced40e390808d
Author: Poul-Henning Kamp <phk at FreeBSD.org>
Date: Tue Oct 9 08:25:36 2018 +0000
Add a crude python2/python3 hack to deal with UTF-8
diff --git a/doc/sphinx/vtc-syntax.py b/doc/sphinx/vtc-syntax.py
index ba7bd6bd7..d98fc96e5 100644
--- a/doc/sphinx/vtc-syntax.py
+++ b/doc/sphinx/vtc-syntax.py
@@ -39,7 +39,12 @@ def parse_file(fn, cl, tl, sl):
section = ""
resec = re.compile("[ /]\* SECTION: ")
- f = open(fn, "r")
+ try:
+ # Python3
+ f = open(fn, "r", encoding="UTF-8")
+ except TypeError:
+ # Python2
+ f = open(fn, "r")
for l in f:
if "*/" in l:
More information about the varnish-commit
mailing list