From 80395f14e8873f30d2c9a49e42fc9febf5c87e45 Mon Sep 17 00:00:00 2001 From: Ebrahim Byagowi Date: Thu, 29 Mar 2018 22:00:41 +0430 Subject: [PATCH] Make gen-* scripts LC_ALL=C compatible (#942) --- src/gen-arabic-table.py | 5 ++--- src/gen-indic-table.py | 4 ++-- src/gen-use-table.py | 4 ++-- 3 files changed, 6 insertions(+), 7 deletions(-) diff --git a/src/gen-arabic-table.py b/src/gen-arabic-table.py index fc60ab415..ccecb406a 100755 --- a/src/gen-arabic-table.py +++ b/src/gen-arabic-table.py @@ -2,14 +2,13 @@ from __future__ import print_function, division, absolute_import -import sys -import os.path +import io, os.path, sys if len (sys.argv) != 4: print ("usage: ./gen-arabic-table.py ArabicShaping.txt UnicodeData.txt Blocks.txt", file=sys.stderr) sys.exit (1) -files = [open (x) for x in sys.argv[1:]] +files = [io.open (x, encoding='utf-8') for x in sys.argv[1:]] headers = [[files[0].readline (), files[0].readline ()], [files[2].readline (), files[2].readline ()]] headers.append (["UnicodeData.txt does not have a header."]) diff --git a/src/gen-indic-table.py b/src/gen-indic-table.py index 1a5d77618..6252664ca 100755 --- a/src/gen-indic-table.py +++ b/src/gen-indic-table.py @@ -2,7 +2,7 @@ from __future__ import print_function, division, absolute_import -import sys +import io, sys if len (sys.argv) != 4: print ("usage: ./gen-indic-table.py IndicSyllabicCategory.txt IndicPositionalCategory.txt Blocks.txt", file=sys.stderr) @@ -32,7 +32,7 @@ ALLOWED_BLOCKS = [ 'Myanmar Extended-A', ] -files = [open (x) for x in sys.argv[1:]] +files = [io.open (x, encoding='utf-8') for x in sys.argv[1:]] headers = [[f.readline () for i in range (2)] for f in files] diff --git a/src/gen-use-table.py b/src/gen-use-table.py index ea88cc33e..b3876373d 100755 --- a/src/gen-use-table.py +++ b/src/gen-use-table.py @@ -2,7 +2,7 @@ from __future__ import print_function, division, absolute_import -import sys +import io, sys if len (sys.argv) != 5: print ("usage: ./gen-use-table.py IndicSyllabicCategory.txt IndicPositionalCategory.txt UnicodeData.txt Blocks.txt", file=sys.stderr) @@ -10,7 +10,7 @@ if len (sys.argv) != 5: BLACKLISTED_BLOCKS = ["Thai", "Lao", "Tibetan"] -files = [open (x) for x in sys.argv[1:]] +files = [io.open (x, encoding='utf-8') for x in sys.argv[1:]] headers = [[f.readline () for i in range (2)] for j,f in enumerate(files) if j != 2] headers.append (["UnicodeData.txt does not have a header."])