Your message dated Tue, 04 Aug 2009 01:12:31 -0400
with message-id <[email protected]>
has caused the   report #539756,
regarding xword: add an option to try UTF-8 decoding before ISO-8859-1
to be marked as having been forwarded to the upstream software
author(s) [email protected]

(NB: If you are a system administrator and have no idea what this
message is talking about, this may indicate a serious mail system
misconfiguration somewhere. Please contact [email protected]
immediately.)


-- 
539756: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=539756
Debian Bug Tracking System
Contact [email protected] with problems
--- Begin Message ---
Hi Bill,

I'm passing along this bug and patch received against the Debian xword
package.

I'll do some testing of it myself and possibly add it to the Debian
package, but please let me know (keeping the CC to
[email protected]) if you include it upstream.

Bug:

I can't find any specification of what the character encoding used in
the AcrossLite .PUZ format is supposed to be, but when generating
files to be used by xword it's nice to be able to use UTF-8.  The
attached patch adds a command line option to try decoding strings in
the file as UTF-8 before falling back to the existing default,
ISO-8859-1.  It also adds a usage message.

regards,
mark

-- System Information:
Debian Release: lenny/sid
  APT prefers unstable
  APT policy: (500, 'unstable'), (500, 'testing'), (500, 'stable')
Architecture: i386 (i686)

Kernel: Linux 2.6.26-1-486
Locale: LANG=en_GB.UTF-8, LC_CTYPE=en_GB.UTF-8 (charmap=UTF-8) (ignored: LC_ALL 
set to en_GB.UTF-8)
Shell: /bin/sh linked to /bin/bash

Versions of packages xword depends on:
ii  python                        2.5.2-1    An interactive high-level object-o
ii  python-gtk2                   2.12.1-6   Python bindings for the GTK+ widge

xword recommends no packages.

-- debconf-show failed

--- /usr/games/xword    2009-06-28 05:31:48.000000000 +0100
+++ bin/xword   2009-08-03 13:02:43.000000000 +0100
@@ -52,6 +52,9 @@
 import pickle
 import ConfigParser
 
+from optparse import OptionParser
+try_utf_8_first = False
+
 HOME_PATH = '/usr/share/games/xword'
 CHECK_ICON = HOME_PATH + '/crossword-check.png'
 CHECK_ALL_ICON = HOME_PATH + '/crossword-check-all.png'
@@ -131,6 +134,11 @@
         result = s
         ellipsis_char = 133
         result = result.replace(chr(ellipsis_char), '...')
+        if try_utf_8_first:
+            try:
+                return unicode(result, 'utf_8')
+            except:
+                pass
         result = unicode(result, 'iso_8859-1')
         return result
 
@@ -1812,10 +1820,21 @@
         c.write(file(os.path.expanduser('~/.crossword.cfg'), 'w'))
 
 if __name__ == '__main__':
-    if len(sys.argv) <> 2:
+    
+    parser = OptionParser(usage="Usage: %prog [OPTIONS] [PUZZLE-FILENAME]")
+    parser.add_option('-u', '--utf8', dest="utf8", action="store_true",
+                      default=False, help="Try UTF-8 decoding of clues first.")
+    options,args = parser.parse_args()
+
+    try_utf_8_first = options.utf8
+    
+    if len(args) == 0:
         p = None
+    elif len(args) == 1:
+        p = Puzzle(args[0])
     else:
-        p = Puzzle(sys.argv[1])
+        parser.print_help()
+        sys.exit(1)
         
     w = PuzzleWindow(p)
     gtk.main()


Thanks,
-- 
-John Sullivan
-http://wjsullivan.net
-GPG Key: AE8600B6


--- End Message ---

Reply via email to