trunk/src/LythumOSL.Core/Data/Xml/Xml.cs
/// <summary>
/// Kadangi .net string yra UTF16 formato
/// tai jei serializuota i UTF8 informacija priskiriame string'ui
/// ji vel tampa UTF16, del to geriau is karto saugoti i faila!
/// </summary>
/// <param name="o"></param>
/// <param name="path"></param>
/// <returns></returns>
Kadangi .net string yra UTF16 formato
tai jei serializuota i UTF8 informacija priskiriame string'ui
ji vel tampa UTF16, del to geriau is karto saugoti i faila!
Kadangi . net string yra UTF16 formato tai jei serializuota i UTF8 informacija priskiriame string ' ui ji vel tampa UTF16 del to geriau is karto saugoti i faila!
public static bool UTF8Serialize (
			object o, string path)
		{
			XmlSerializer serializer = new XmlSerializer (o.GetType ());
			XmlWriterSettings settings = new XmlWriterSettings ();
			settings.Encoding = new UTF8Encoding (false); 
			settings.Indent = true;
			settings.OmitXmlDeclaration = false;
			using (StreamWriter writer = new StreamWriter (
				path, 
				false,
				new UTF8Encoding (false, false)))
			{
				using (XmlWriter xmlWriter = XmlWriter.Create (writer, settings))
				{
					serializer.Serialize (xmlWriter, o);
				}
				return true;
			}
		}
public static bool UTF8Serialize ( object o , string path ) { XmlSerializer serializer = new XmlSerializer ( o . GetType ( ) ) ; XmlWriterSettings settings = new XmlWriterSettings ( ) ; settings . Encoding = new UTF8Encoding ( false ) ; settings . Indent = true ; settings . OmitXmlDeclaration = false ; using ( StreamWriter writer = new StreamWriter ( path , false , new UTF8Encoding ( false , false ) ) ) { using ( XmlWriter xmlWriter = XmlWriter . Create ( writer , settings ) ) { serializer . Serialize ( xmlWriter , o ) ; } return true ; } }
Kadangi .net string yra UTF16 formato
tai jei serializuota i UTF8 informacija priskiriame string'ui
ji vel tampa UTF16, del to geriau is karto saugoti i faila!
Kadangi . net string yra UTF16 formato tai jei serializuota i UTF8 informacija priskiriame string ' ui ji vel tampa UTF16 del to geriau is karto saugoti i faila!
// no BOM in a .NET string
None
o
object
None
path
string
None