Encoding is not my strong point, despite having read quite a bit.
There's a file I want to edit, its extension is .tdl, but that doesn't mean anything in particular.
It is an XML file. The first line looks like this:
<?xml version="1.0" encoding="utf-16"?>
When I try to open this file with gedit I get a big message on a yellow background, saying:
"There was a problem opening the file ... The file you opened has some invalid characters. If you continue editing this file you could corrupt this document. You can also choose another character encoding and try again"
The Character Encoding dropdown box under this says "Current Locale (UTF-8)".
I try to set that to "Unicode (UTF-16)" and click "Retry". The nasty message comes back and the dropdown is set back to "Current Locale (UTF-8)".
I've also tried opening the file by going File --> Open --> Character Encoding: change from "Automatically Detected" to "Unicode (UTF-16)". But I get the nasty message again, again with the dropdown set to "Current Locale (UTF-8)".
Programmatically (using Groovy, groovy.xml.XMLParser
) I am able to parse this file and produce a seemingly valid groovy.util.Node
structure. I haven't yet got to the stage of trying to save this internal Node structure, whether modified or not.
Can someone tell me what's wrong (if anything) with this file, and how I might edit it safely?