This:
$XML = new SimpleXMLElement(\" \");
echo($XML->asXML());
...outputs this:
You can try this, but you must use simplexml_load_string for $xml
$xml // Your main SimpleXMLElement
$xml->addAttribute('encoding', 'UTF-8');
Or you can still use other means to add the encoding to your output.
Simple Replacement
$outputXML=str_replace('', '', $outputXML);
Regular Expressions
$outputXML=preg_replace('/<\?\s*xml([^\s]*)\?>/' '', $outputXML);
DOMDocument - I know you said you don't want to use DOMDocument, but here is an example
$xml=dom_import_simplexml($simpleXML);
$xml->xmlEndoding='UTF-8';
$outputXML=$xml->saveXML();
You can wrap this code into a function that receives a parameter $encoding and adds it to the