Jump to content

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" ...

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.