php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #29988 Errors with encoding
Submitted: 2004-09-05 17:17 UTC Modified: 2004-09-06 08:22 UTC
From: lehphyro at yahoo dot com dot br Assigned:
Status: Not a bug Package: SimpleXML related
PHP Version: 5.0.1 OS: Windows
Private report: No CVE-ID: None
View Add Comment Developer Edit
Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know!
Just going to say 'Me too!'? Don't clutter the database with that please !
Your email address:
MUST BE VALID
Solve the problem:
11 + 48 = ?
Subscribe to this entry?

 
 [2004-09-05 17:17 UTC] lehphyro at yahoo dot com dot br
Description:
------------
I tried to load a xml file with ISO-8859-1 encoding.

I have tried several ways for loading, but I had no success because simplexml returns the loaded string with errors.

I have tried iconv functions too.

Reproduce code:
---------------
file test.php:
<?php
include ("example.php");

$xml = simplexml_load_string($xmlstr);

echo $xml->movie[0]->plot;
?>

file example.php:
<?php
$xmlstr = <<<XML
<?xml version='1.0' encoding="ISO-8859-1"?>
<movies>
 <movie>
  <plot>
   Matr?cula
  </plot>
 </movie>
</movies>
XML;
?>

Expected result:
----------------
Matr?cula

Actual result:
--------------
MatrĂ­cula

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2004-09-06 08:22 UTC] derick@php.net
Not a bug, SimpleXML always converts to utf-8 internally. (Like any XML extension in PHP).
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sat Apr 20 04:01:28 2024 UTC