Jump to content

load XML - problem with encoding


rokerkony

Recommended Posts

Hi, I need to import data from XML file.

I have my web page in UTF-8 encoding and XML file is also in UTF-8.

 

when I load XML file (with czech content) with function simplexml_load_file($file) so i get for example "TĂlka" or "zimnĂ  snowboardovĂ© bundy" etc.

 

I try to use iconv, but i don't know how, when the both encoding must be the same :-/

 

thanks for answer

 

 

xml file is here: http://www.konradcerny.cz/xml.xml

Link to comment
https://forums.phpfreaks.com/topic/206999-load-xml-problem-with-encoding/
Share on other sites

I tried to write this simple code:

 

<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html;charset=utf-8">
</head>
<body>
<?php
	$xml = simplexml_load_file('http://www.konradcerny.cz/xml.xml');
	foreach($xml as $value) {
		$_COLOR = $value->COLOR;
		echo $_COLOR;
		exit;
	}
?>
</body></html>

 

and it's working....

 

But the thing is that I import data from XML in the model ... i mean that it has no idea about HTML and meta tag "content-type" ...

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.