Changeset 718
- Timestamp:
- 06/08/07 20:18:24 (1 year ago)
- Files:
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/src/main/php/net/stubbles/xml/stubDomXMLStreamWriter.php
r678 r718 111 111 */ 112 112 public function writeCData($cdata) { 113 $cdataNode = $this->doc->createCDATASection( $cdata);113 $cdataNode = $this->doc->createCDATASection(utf8_encode($cdata)); 114 114 $this->addToDom($cdataNode); 115 115 } … … 121 121 */ 122 122 public function writeComment($comment) { 123 $commentNode = $this->doc->createComment( $comment);123 $commentNode = $this->doc->createComment(utf8_encode($comment)); 124 124 $this->addToDom($commentNode); 125 125 } … … 132 132 */ 133 133 public function writeProcessingInstruction($target, $data = '') { 134 $piNode = $this->doc->createProcessingInstruction($target, $data);134 $piNode = $this->doc->createProcessingInstruction($target, utf8_encode($data)); 135 135 $this->addToDom($piNode); 136 136 } … … 155 155 public function writeAttribute($attributeName, $attributeValue) { 156 156 $currentElement = end($this->elementStack); 157 $currentElement->setAttribute($attributeName, $attributeValue);157 $currentElement->setAttribute($attributeName, utf8_encode($attributeValue)); 158 158 } 159 159 trunk/src/test/php/net/stubbles/xml/stubXMLSerializerTestCase.php
r717 r718 205 205 return null; 206 206 } 207 } 208 209 /** 210 * Class to test german umlaut properties 211 * 212 * @XMLTag(tagName='test') 213 */ 214 class XMLSerializerUmlautTest { 215 216 /** 217 * test property 218 * 219 * @var string 220 * @XMLTag(tagName='foo') 221 */ 222 public $foo = 'Hähnchen'; 223 224 /** 225 * test property 226 * 227 * @var string 228 * @XMLAttribute(attributeName='bar') 229 */ 230 public $ba = 'Hühnchen'; 231 207 232 } 208 233 … … 396 421 397 422 /** 423 * Test serializing an object with umlauts 424 */ 425 public function testObjectUmlauts() { 426 $writer = new stubDomXMLStreamWriter(); 427 $obj = new XMLSerializerUmlautTest(); 428 $this->serializer->serialize($obj, $writer); 429 $this->assertEqual('<?xml version="1.0" encoding="ISO-8859-1"?>' . "\n" . '<test bar="Hühnchen"><foo>Hähnchen</foo></test>', $writer->asXML()); 430 } 431 432 /** 398 433 * Test serializing an object with a method matcher 399 434 */
