BUG#:8764
authormarek <marek>
Mon, 10 May 2010 10:51:00 +0000 (10:51 +0000)
committermarek <marek>
Mon, 10 May 2010 10:51:00 +0000 (10:51 +0000)
TITLE: SCMOXmlWriter does not correctly write UTF-8 multibyte chars

DESCRIPTION:

src/Pegasus/Common/XmlGenerator.cpp

index 507978f5eebe1f9c6f698161db999c1c763d36a2..5a63e5d5d1d3d78c333aa08996ddf7046a4dcfdd 100644 (file)
@@ -194,9 +194,9 @@ static const SpecialChar _specialChars[] =
 };
 
 // If _isSpecialChar7[ch] is true, then ch is a special character, which must
-// have a special encoding in XML. But only use 7-bit ASCII characters to
-// index this array.
-static const int _isSpecialChar7[] =
+// have a special encoding in XML.
+// Remaining 128 values are automatically initialised to 0 by compiler.
+static const int _isSpecialChar7[256] =
 {
     1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,0,1,0,0,
     0,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,1,0,0,0,0,0,0,0,0,0,0,0,
@@ -205,14 +205,18 @@ static const int _isSpecialChar7[] =
 };
 
 // If _isSpecialChar7[ch] is true, then ch is a special character, which must
-// have a special encoding in XML. But only use 7-biat ASCII characters to
-// index this array.
+// have a special encoding in XML.
 static const int _isNormalChar7[] =
 {
     0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,0,1,1,
     1,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,1,0,1,1,1,1,1,1,1,1,1,1,1,
     1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
     1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,
+// remaining 128 values are used on multi-byte UTF-8 and should not be escaped
+    1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
+    1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
+    1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
+    1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1
 };