Windows phone 7 如何在windows phone中正确读取txt文件?
我尝试读取包含下一个内容的txt文件: 我使用此方法读取txt文件:Windows phone 7 如何在windows phone中正确读取txt文件?,windows-phone-7,encoding,text-files,Windows Phone 7,Encoding,Text Files,我尝试读取包含下一个内容的txt文件: 我使用此方法读取txt文件: 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));
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;
}
此方法返回给我下一个符号错误的字符串:
如何正确读取txt文件???如何显示文本?也许是打印代码而不是阅读代码
另外,文件上的错误是否正确?我相信前3个字节指定了编码类型。这种编码正确吗?错误的符号:在Windows Phone上读取ANSI编码的文本文件时,由于必须在Windows Phone上使用UTF-8,因此会导致UMLAUT、特殊字符等“看起来错误”。调试中我要从变量复制的文本如果您将实体用于“®”是否有效?