Creating .xml file with file_put_contents and german chars????

Discussion in 'PHP' started by 123GoToAndPlay, Dec 18, 2009.

  1. #1
    Hi all,

    I am having problems with creating a .xml file with german characters, like ü, ö.
    which i parse with flash

    If i have the following in content-de.xml
    
     <pageTitle><![CDATA[über]]></pageTitle>
    
    Code (markup):
    it works allright

    but when i edit the xml file and make another xml node
    
    	$content = $xml->asXML();
    	$content = str_replace('<pageTitle>','<pageTitle><![CDATA[',trim($content));
    	$content = str_replace('</pageTitle>',']]></pageTitle>',trim($content));
    	
    	$content =  html_entity_decode($content);
    
    	$res = file_put_contents("content-".$lang.".xml", $content);
    
    Code (markup):
    the content-de.xml title node looks the same, but in flash it is parse something like ü.

    Now apparently php function file_put_contents() adds something to the xml file???

    I have copied all the code from the .xml created with file_put_contents() into the "handmade" xml file and it works correctly. So it has to do with the way file_put_contents creates the .xml

    How can i fix this??

    ps: i am looking into iconv function, but no luck yet
     
    Last edited: Dec 18, 2009
    123GoToAndPlay, Dec 18, 2009 IP