diff options
author | Ross Lagerwall <rosslagerwall@gmail.com> | 2013-06-18 08:48:44 +0100 |
---|---|---|
committer | Dan Winship <danw@gnome.org> | 2013-07-13 11:40:14 -0400 |
commit | 74f27b8305cfbcf9324a07bea93829237c86e687 (patch) | |
tree | 761a8f32c6e51b502a51e5938e4b7be76ccaa279 | |
parent | fb09bf930c5e0e79b67fbbd323b46284591b8624 (diff) | |
download | libsoup-74f27b8305cfbcf9324a07bea93829237c86e687.tar.gz |
tld-parser.py: Force file io to use utf-8
This fixes an issue where the build would fail with a UnicodeDecodeError
when run in a non-utf8 locale (which is typical in build environments)
using Python 3.
https://bugzilla.gnome.org/show_bug.cgi?id=702534
-rwxr-xr-x | libsoup/tld-parser.py | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/libsoup/tld-parser.py b/libsoup/tld-parser.py index c1a0346f..5d9d2ba5 100755 --- a/libsoup/tld-parser.py +++ b/libsoup/tld-parser.py @@ -5,13 +5,14 @@ # Based on tld-parser.c Copyright (C) 2012 Igalia S.L. import sys +import codecs SOUP_TLD_RULE_NORMAL = 0 SOUP_TLD_RULE_MATCH_ALL = 1 << 0 SOUP_TLD_RULE_EXCEPTION = 1 << 1 -tlds_file = open(sys.argv[1]) -inc_file = open(sys.argv[2], 'w') +tlds_file = codecs.open(sys.argv[1], encoding='utf-8') +inc_file = codecs.open(sys.argv[2], 'w', encoding='utf-8') first = True for rule in tlds_file: |