Thursday, 18 November 2010

PHP: DOMDocument and encoding

If you want to save document with not typical encoding, for example utf-8 (russian letters)

If you do like this:
$doc = new DOMDocument('1.0','UTF-8');
It will be wrong, because php does't know what encoding will be.For normal working you should use:
$doc->encoding='UTF-8';
ps: Next will be some articles about working with xml in php

1 comment: