Both of decimal and hexadecimal representations are valid.
If it is important to have decimal values for some artificial reasons, then maybe consider a custom writer:
using( var w = new MyXmlTextWriter( path, new UTF8Encoding( false ) ) )
{
xdoc.Save( w );
}
where MyXmlTextWriter is something like this:
public class MyXmlTextWriter : System.Xml.XmlTextWriter
{
public MyXmlTextWriter( string filename, Encoding? encoding )
: base( filename, encoding )
{
}
public override void WriteString( string? text )
{
string[] a = text.Split( "\r\n" );
for( int i = 0; i < a.Length; i++ )
{
if( i > 0 )
{
base.WriteRaw( " " );
}
base.WriteString( a[i] );
}
}
}