I try to read txt file with next content:
I using this method to read txt file:
public string ReadFileContents()
{
//this verse is loaded for the first time so fill it from the text file
var ResrouceStream = Application.GetResourceStream(new Uri("Files/info.txt", UriKind.Relative));
if (ResrouceStream != null)
{
Stream myFileStream = ResrouceStream.Stream;
if (myFileStream.CanRead)
{
StreamReader myStreamReader = new StreamReader(myFileStream);
//read the content here
return myStreamReader.ReadToEnd();
}
}
return string.Empty;
}
This method return to me next string with wrong symbols:
How I can correctly read txt file??
How are you showing the text? Maybe it’s the printing code rather than the reading code.
Also, is the BOM correct on the file? I believe the first 3 bytes specify the encoding type. Are they correct for this encoding?