[master] fa33ec523 Add a crude python2/python3 hack to deal with UTF-8

Poul-Henning Kamp phk at FreeBSD.org
Tue Oct 9 09:09:13 UTC 2018


commit fa33ec52361eddeb03f3bb0129663a7149a2e045
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