我有一个文本文件
abc
aäá
äöü
...
并希望StreamReader将每一行写入单个列表项。我目前正在这样做:
string dict = "dict.txt"
StreamReader sr = new StreamReader(App.GetResourceStream(new Uri(dict, UriKind.RelativeOrAbsolute)).Stream);
for (string tmp = sr.ReadLine(); tmp != null; tmp = sr.ReadLine())
{
dictionary.Add(tmp);
}
StreamReader无法读取像äöü这样的扩展字符。我尝试通过将编码指定为默认值来修复它。但是WP7不支持这种编码。
StreamReader sr = new StreamReader(App.GetResourceStream(new Uri(dict, UriKind.RelativeOrAbsolute)).Stream, System.Text.Encoding.Default);
我该怎么办?