2021-02-02 16:32:37 +01:00
|
|
|
From: NOKUBI Takatsugu <knok@daionet.gr.jp>
|
|
|
|
Date: Thu, 2 Nov 2017 15:11:52 +0900
|
|
|
|
Subject: read utf-8 encoded zipfile
|
|
|
|
|
|
|
|
---
|
|
|
|
anthy form Debian converted those zipfile to utf-8
|
|
|
|
data/zipcode-textdic.py | 4 ++--
|
|
|
|
1 file changed, 2 insertions(+), 2 deletions(-)
|
|
|
|
|
|
|
|
diff --git a/data/zipcode-textdic.py b/data/zipcode-textdic.py
|
|
|
|
index 6fa50d6..cb28a1f 100755
|
srcpkgs/i*: convert patches to -Np1
```sh
git grep -l '^patch_args=-Np0' "srcpkgs/$1*/template" |
while read template; do
for p in ${template%/template}/patches/*; do
sed -i '
\,^[+-][+-][+-] /dev/null,b
/^[*-]\+ [0-9]\+\(,[0-9]\+\)\? [*-]\+$/b
s,^[*][*][*] ,&a/,
/^--- /{
s,\(^--- \)\(./\)*,\1a/,
s,[.][Oo][Rr][Ii][Gg]\([ /]\),\1,
s/[.][Oo][Rr][Ii][Gg]$//
s/[.]patched[.]\([^.]\)/.\1/
h
}
/^+++ -/{
g
s/^--- a/+++ b/
b
}
s,\(^+++ \)\(./\)*,\1b/,
' "$p"
done
sed -i '/^patch_args=/d' $template
done
```
2021-06-19 05:03:21 +02:00
|
|
|
--- a/data/zipcode-textdic.py
|
|
|
|
+++ b/data/zipcode-textdic.py
|
2021-02-02 16:32:37 +01:00
|
|
|
@@ -21,9 +21,9 @@ if len(sys.argv) < 2:
|
|
|
|
anthy_zipfile = sys.argv[1]
|
|
|
|
|
|
|
|
try:
|
|
|
|
- contents = codecs.open(anthy_zipfile, 'r', 'euc_jp').read()
|
|
|
|
+ contents = codecs.open(anthy_zipfile, 'r', 'utf-8').read()
|
|
|
|
except UnicodeDecodeError as e:
|
|
|
|
- print('Your file is not eucJP? %s' % anthy_zipfile, file=sys.stderr)
|
|
|
|
+ print('Your file is not of UTF-8? %s' % anthy_zipfile, file=sys.stderr)
|
|
|
|
contents = open(anthy_zipfile).read()
|
|
|
|
|
|
|
|
output_zipfile = codecs.open('zipcode.t', 'w', 'utf-8')
|