summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBarry Warsaw <barry@python.org>2000-02-27 14:30:48 (GMT)
committerBarry Warsaw <barry@python.org>2000-02-27 14:30:48 (GMT)
commit7733e12c9cc0fbff9740ba6035bc5d266648449b (patch)
tree74a07775be1c5a5d93b140fe61263bf5e26c96a4
parentc8f0892d1236df81af1811cf182692f28c85f916 (diff)
downloadcpython-7733e12c9cc0fbff9740ba6035bc5d266648449b.zip
cpython-7733e12c9cc0fbff9740ba6035bc5d266648449b.tar.gz
cpython-7733e12c9cc0fbff9740ba6035bc5d266648449b.tar.bz2
Two buglet fixes. Peter Funk caught the bug in make_escapes:
This will fold all ISO 8859 chars from the upper half of the charset into the lower half, which is ...ummm.... unintened. The second is a typo in the reference to options.escape in main().
-rwxr-xr-xTools/i18n/pygettext.py16
1 files changed, 9 insertions, 7 deletions
diff --git a/Tools/i18n/pygettext.py b/Tools/i18n/pygettext.py
index 4ff4962..c39ce6e 100755
--- a/Tools/i18n/pygettext.py
+++ b/Tools/i18n/pygettext.py
@@ -165,13 +165,15 @@ escapes = []
def make_escapes(pass_iso8859):
global escapes
+ if pass_iso8859:
+ # Allow iso-8859 characters to pass through so that e.g. 'msgid
+ # "Höhe"' would result not result in 'msgid "H\366he"'. Otherwise we
+ # escape any character outside the 32..126 range.
+ mod = 128
+ else:
+ mod = 256
for i in range(256):
- if pass_iso8859:
- # Allow iso-8859 characters to pass through so that e.g. 'msgid
- # "Höhe"' would result not result in 'msgid "H\366he"'. Otherwise
- # we escape any character outside the 32..126 range.
- i = i % 128
- if 32 <= i <= 126:
+ if 32 <= (i % mod) <= 126:
escapes.append(chr(i))
else:
escapes.append("\\%03o" % i)
@@ -373,7 +375,7 @@ def main():
options.excludefilename = arg
# calculate escapes
- make_escapes(options.escapes)
+ make_escapes(options.escape)
# calculate all keywords
options.keywords.extend(default_keywords)