Hi Alex,
> I've changed tree.py to print all nodes in nodeToJsonString() and what i 
> see is that all german umlauts are not accepted. For example
> "ΓΌ" has hex-value C3 BC what as far as i know is a valid UTF-8 format, 
> isn't accepted. And i do not have this problems with "make build"
> because these are only comments that contain umlauts.
> My Editor(Aptana IDE) is preset to use UTF-8.
>   
>> Have a look at http://bugzilla.qooxdoo.org/show_bug.cgi?id=269
>>
>> I had that error when trying to solve another problem and had to patch the 
>> generator so it would work. You'll have to find the specific place which has 
>> a problem
this problem was similar to the one described by Hugh. I have fixed it 
in svn. If you want to patch your generator, here is the diff:

Modified: trunk/qooxdoo/frontend/framework/tool/modules/filetool.py
===================================================================
--- trunk/qooxdoo/frontend/framework/tool/modules/filetool.py   2007-01-24 
13:19:35 UTC (rev 5832)
+++ trunk/qooxdoo/frontend/framework/tool/modules/filetool.py   2007-01-24 
13:46:37 UTC (rev 5833)
@@ -3,7 +3,7 @@
 import os, codecs, cPickle, sys
 import textutil
 
-def save(filePath, content="", encoding="utf_8"):
+def save(filePath, content="", encoding="utf-8"):
   # Normalize
   filePath = normalize(filePath)
 
@@ -13,7 +13,7 @@
   # Writing file
   try:
     outputFile = codecs.open(filePath, encoding=encoding, mode="w", 
errors="replace")
-    outputFile.write(content)
+    outputFile.write(content.decode("utf-8"))
   except IOError, (errno, strerror):
     print "  * I/O error(%s): %s" % (errno, strerror)
     sys.exit(1)

Modified: trunk/qooxdoo/frontend/framework/tool/modules/tree.py
===================================================================
--- trunk/qooxdoo/frontend/framework/tool/modules/tree.py       2007-01-24 
13:19:35 UTC (rev 5832)
+++ trunk/qooxdoo/frontend/framework/tool/modules/tree.py       2007-01-24 
13:46:37 UTC (rev 5833)
@@ -470,7 +470,7 @@
 
 
 
-def nodeToXmlString(node, prefix = "", childPrefix = "  ", newLine="\n"):
+def nodeToXmlString(node, prefix = "", childPrefix = "  ", newLine="\n", 
encoding="utf-8"):
   hasText = False
   asString = prefix + "<" + node.type
   if node.hasAttributes():
@@ -478,7 +478,7 @@
       if key == "text":
         hasText = True
       else:
-        asString += " " + key + "=\"" + escapeXmlChars(node.attributes[key], 
True) + "\""
+        asString += " " + key + "=\"" + escapeXmlChars(node.attributes[key], 
True, encoding) + "\""
 
   if not node.hasChildren() and not hasText:
     asString += "/>" + newLine
@@ -491,12 +491,12 @@
       else:
         asString += newLine + prefix + childPrefix
 
-      asString += "<text>" + escapeXmlChars(node.attributes["text"], False) + 
"</text>" + newLine
+      asString += "<text>" + escapeXmlChars(node.attributes["text"], False, 
encoding) + "</text>" + newLine
 
     if node.hasChildren():
       asString += newLine
       for child in node.children:
-        asString += nodeToXmlString(child, prefix + childPrefix, childPrefix, 
newLine)
+        asString += nodeToXmlString(child, prefix + childPrefix, childPrefix, 
newLine, encoding)
 
     asString += prefix + "</" + node.type + ">" + newLine
 
@@ -538,7 +538,10 @@
 
 
 
-def escapeXmlChars(text, inAttribute):
+def escapeXmlChars(text, inAttribute, encoding="utf-8"):
+  if isinstance(text, unicode):
+    text = text.encode(encoding)
+  
   if isinstance(text, basestring):
     text = text.replace("&", "&amp;").replace("<", "&lt;").replace(">", "&gt;")
     if inAttribute:
@@ -553,6 +556,9 @@
 
 
 def escapeJsonChars(text):
+  if isinstance(text, unicode):
+      text = text.encode("utf-8")
+
   if isinstance(text, basestring):
     text = text.replace('"', '\\"').replace('\n', '\\n').replace('\r', '\\r')
   elif isinstance(text, bool):







-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
qooxdoo-devel mailing list
qooxdoo-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel

Reply via email to