Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p><code>resolveExternals</code> and <code>substituteEntities</code> are parser features. They don't have an effect on serialisation.</p> <p>The XML infoset doesn't make any distinction whatsoever between:</p> <pre><code>&lt;loc&gt;http://www.somesite.com/serviços/redesign&lt;/loc&gt; &lt;loc&gt;http://www.somesite.com/servi&amp;#xE7;os/redesign&lt;/loc&gt; &lt;loc&gt;http://www.somesite.com/servi&amp;#231;os/redesign&lt;/loc&gt; </code></pre> <p>they all represent exactly the same information, any XML parser must treat them as identical, and XML serializers don't generally let you choose which to output. Normally you should just set the text node's value to include <code>ç</code> and let the serialiser write it to <code>ç</code>, as a raw UTF-8 byte string in the output.</p> <p>If you really must generate an XML file that contains only ASCII, so you can't use characters like <code>ç</code> directly, then tell PHP to use ASCII as the document encoding:</p> <pre><code>$s= "serviços"; // or "\xC3\xA7" if you can't input UTF-8 strings directly $doc = new DOMDocument('1.0', 'US-ASCII'); $doc-&gt;appendChild($loc= $doc-&gt;createElement('loc')); $loc-&gt;appendChild($doc-&gt;createTextNode($s)); echo $doc-&gt;saveXML(); </code></pre> <p>result:</p> <pre><code>&lt;?xml version="1.0" encoding="US-ASCII"?&gt; &lt;loc&gt;servi&amp;#231;os&lt;/loc&gt; </code></pre> <p>However... having said all that, I still don't think this is right. Your value seems to be a URL, and non-ASCII characters aren't valid in URLs regardless of how they're encoded in the containing XML. It should be:</p> <pre><code>http://www.somesite.com/servi%C3%A7os/redesign </code></pre> <p>ie. <code>rawurlencode('serviços')</code>.</p>
    singulars
    1. This table or related slice is empty.
    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.
 

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