How do Handle Non Byte order Mark UTF-8 text file handles japanese language with MSWord conversion
HI i have a Text file which has a japanese character て
how can i handle this japanese character with MSWord Conversion.
What I have tried:
byte[] utf8Preamble = System.Text.Encoding.UTF8.GetPreamble();
int byteLength = utf8Preamble.Length;
byte[] theData = new byte[byteLength];
System.IO.FileStream fs = new System.IO.FileStream(@"c:\folder\file.txt", System.IO.FileMode.Open, System.IO.FileAccess.Read);
fs.Read(theData, 0, byteLength);
fs.Close();
bool utf8PreembleExists = EncodingCompare(utf8Preamble, theData);
if (!utf8PreembleExists)
{
WordDocument = Documents.OpenNoRepairDialog(FileName: paramSourceDocPath,
ConfirmConversions: ConfirmConversion, ReadOnly: ReadOnly,
OpenAndRepair: OpenAndRepair, NoEncodingDialog: NoEncodingDialog);
if (WordDocument.OpenEncoding ==
Microsoft.Office.Core.MsoEncoding.msoEncodingUTF8)
{
object SaveChanges = false;
object RouteWB = false;
WordDocument.Close(ref SaveChanges, ref ParamMissing, ref RouteWB);
object Encoding = Microsoft.Office.Core.MsoEncoding.msoEncodingWestern;
WordDocument = Documents.OpenNoRepairDialog(FileName: paramSourceDocPath,
ConfirmConversions: ConfirmConversion, ReadOnly: ReadOnly, Encoding: Encoding, OpenAndRepair: OpenAndRepair, NoEncodingDialog: NoEncodingDialog);
}
}