[Python-checkins] CVS: python/dist/src/Tools/i18n pygettext.py,1.6,1.7

Barry A. Warsaw bwarsaw@cnri.reston.va.us
Sun, 27 Feb 2000 09:30:51 -0500 (EST)


Update of /projects/cvsroot/python/dist/src/Tools/i18n
In directory anthem:/home/bwarsaw/projects/python/Tools/i18n

Modified Files:
	pygettext.py 
Log Message:
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().


Index: pygettext.py
===================================================================
RCS file: /projects/cvsroot/python/dist/src/Tools/i18n/pygettext.py,v
retrieving revision 1.6
retrieving revision 1.7
diff -C2 -r1.6 -r1.7
*** pygettext.py	2000/02/26 20:56:47	1.6
--- pygettext.py	2000/02/27 14:30:48	1.7
***************
*** 166,176 ****
  def make_escapes(pass_iso8859):
      global escapes
      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:
              escapes.append(chr(i))
          else:
--- 166,178 ----
  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 32 <= (i % mod) <= 126:
              escapes.append(chr(i))
          else:
***************
*** 374,378 ****
  
      # calculate escapes
!     make_escapes(options.escapes)
  
      # calculate all keywords
--- 376,380 ----
  
      # calculate escapes
!     make_escapes(options.escape)
  
      # calculate all keywords