]> andersk Git - zcommit.git/commitdiff
Unicode support.
authorAnders Kaseorg <andersk@mit.edu>
Tue, 30 Mar 2010 01:47:34 +0000 (21:47 -0400)
committerAnders Kaseorg <andersk@mit.edu>
Tue, 30 Mar 2010 01:49:53 +0000 (21:49 -0400)
The previous code would blow up on all non-ASCII authors, commit
messages, or arguments.  We can eliminate character set discrimination
in our lifetimes, if we all just come together.

Signed-off-by: Anders Kaseorg <andersk@mit.edu>
zcommit.py

index 6c66b50095e31968726af683b2d4607347276376..1f37853ba64505d82fe36dea7d8dc0709b49a7de 100755 (executable)
@@ -35,7 +35,7 @@ msg: %(msg)s""" % {'sender' : sender,
                    'msg' : msg})
     cmd = [ZWRITE, '-S', sender, '-c', klass, '-i', instance,
            '-s', zsig, '-d', '-m', msg]
-    subprocess.check_call([str(p) for p in cmd])
+    subprocess.check_call([p.encode('utf-8') for p in cmd])
 
 class Application(object):
     @cherrypy.expose
@@ -91,7 +91,7 @@ any of the following optional key/value parameters:
                 raise cherrypy.HTTPError(400, 'Invalid submission URL')
             logger.debug('Passed validation')
             for i in xrange(0, len(args), 2):
-                opts[args[i]] = args[i + 1]
+                opts[args[i]] = unicode(args[i + 1], 'utf-8', 'replace')
             logger.debug('Set opts')
             if 'class' not in opts:
                 raise cherrypy.HTTPError(400, 'Must specify a zephyr class name')
This page took 0.367911 seconds and 5 git commands to generate.