Encoding
Brought to you by:
bmatzelle
Hi,
My compliments on the usefullness of this library. I
have one request/question about using this library
with alternate encoding. When creating the xml config,
there is no UTF-8 or UTF-16 or ASCII encoding
declaration or choice. The actual encoding is unknown
to all but NINI itself. This would be useful for other
readers of the same config data that require encoding
knowledge. Thanks.
Regards,
Alan
Logged In: YES
user_id=163900
Nini already has this support. Here is how you load it with
UTF-8:
--------
using System.IO;
using System.Text;
StreamReader reader = new StreamReader("myFile.xml",
Encoding.UTF8);
XmlConfigSource source = new XmlConfigSource(reader);
--------
Here is how to save it in UTF-8:
--------
using System.IO;
using System.Text;
StreamWriter writer = new StreamWriter("myFile.xml", true,
Encoding.UTF8);
source.Save(writer);
--------