Author: ai0867
Date: Fri Sep 19 15:08:14 2008
New Revision: 29547

URL: http://svn.gna.org/viewcvs/wesnoth?rev=29547&view=rev
Log:
* Force wmldata.py to print utf-8, so it doesn't crash when encountering it.
* If your terminal does not support utf-8 though, this will make a big mess.

Modified:
    trunk/data/tools/wesnoth/wmldata.py

Modified: trunk/data/tools/wesnoth/wmldata.py
URL: 
http://svn.gna.org/viewcvs/wesnoth/trunk/data/tools/wesnoth/wmldata.py?rev=29547&r1=29546&r2=29547&view=diff
==============================================================================
--- trunk/data/tools/wesnoth/wmldata.py (original)
+++ trunk/data/tools/wesnoth/wmldata.py Fri Sep 19 15:08:14 2008
@@ -14,6 +14,7 @@
 
 import re, sys
 import wmlparser
+import codecs
 
 class Data:
     """Common subclass."""
@@ -34,7 +35,9 @@
         if show_contents:
             result += "'" + self.get_value() + "'"
         if write:
-            sys.stdout.write(result + "\n")
+            # The below is a pretty ugly hack forcing python to accept utf-8
+            # If your terminal can't handle utf-8, you'll obviously get a big 
mess (but otherwise you'd get a crash)
+            codecs.getwriter('utf-8')(sys.stdout).write(result + "\n")
 
         else: return result
 


_______________________________________________
Wesnoth-commits mailing list
[email protected]
https://mail.gna.org/listinfo/wesnoth-commits

Reply via email to