Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Technically your string is in UTF8, but the HTML encoded characters (when rendered by the browser) are not in UTF8. So <code>&amp;#xa869;</code> is a valid UTF8 String, but the character that is rendered onto the screen from the web browser is not valid UTF8.</p> <p>I would also wrap your echo to the screen (last 2 lines in your example) like this: </p> <pre><code>echo "&lt;p&gt;straight from db = &lt;xmp&gt;".$a-&gt;new_value."&lt;/xmp&gt;&lt;/p&gt;"; echo "&lt;p&gt;utf8_decode() = &lt;xmp&gt;".utf8_decode($a-&gt;new_value)."&lt;/xmp&gt;&lt;/p&gt;"; </code></pre> <p>This will clearly display the point i am making above.</p> <p><strong>Edit:</strong></p> <p>The problem actually is an uncontrollable undocumented "Feature" in simplexml_load_string() for PHP. It will automatically convert all characters from their XML entity form strait into their actual char form. The only way to circumvent this is to use simplexml_load_string() like this:</p> <pre><code> $data = simplexml_load_string( '&lt;?xml version="1.0" encoding="utf-8"?&gt; &lt;audit&gt; &lt;audit_detail&gt; &lt;fieldname&gt;role_fra&lt;/fieldname&gt; &lt;old_value&gt;&lt;![CDATA[aRo&amp;#x9A6C;e&amp;#x7833;&amp;#x9825;n fran&amp;#xA869;s]]&gt;&lt;/old_value&gt; &lt;new_value&gt;&lt;![CDATA[bRo&amp;#x9A6C;e&amp;#x7833;&amp;#x9825;n fran&amp;#xA869;s]]&gt;&lt;/new_value&gt; &lt;/audit_detail&gt; &lt;/audit&gt;', "SimpleXMLElement", LIBXML_NOENT | LIBXML_NOCDATA ); print "&lt;PRE&gt;"; print_r($data); exit; </code></pre> <p>You must wrap your elements in <code>&lt;![CDATA[]]&gt;</code> tags and then pass the LIBXML_NOCDATA option to the xml parser. This will force the things in <code>&lt;![CDATA[]]&gt;</code> tags to be cast as String type and PHP can properly handle that outside of a SimpleXMLObject.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload