So I have this script that reads the xml, modifies the selected node value and saves it.
The xml files have <?xml version="1.0" encoding="ISO-8859-15"?> and that cannot be changed.
These node values may have accented characters (scandinavian ones ä,ö,å).
The problem comes when saving the modified node values IF they have these accented characters. If they have them it swipes all the exsisting data on the xml saving only <?xml version="1.0"?>.
How can I get it save it without doing that and at the same time read it without the characters going all messed up like “Ö”?
Quoting the manual: “The DOM extension uses UTF-8 encoding. Use utf8_encode() and utf8_decode() to work with texts in ISO-8859-1 encoding or Iconv for other encodings.”
As a workaround, you might also consider replacing all occurrences of non-ASCII characters by numeric references, like “ä” by
ä. This would make the data “encoding-safe”.