除了英语,我无法向Results.csv 写任何阿拉伯语或希伯来语。每次我尝试写其中任何一个时,我都会得到乱码,在 CSV 文件中,它应该有正确的阿拉伯语或希伯来语单词。
我一直在尝试使用 UTF8Encoding,但我显然做错了什么。
请看一下并尝试纠正我:
private void WriteToCsvFile()
{
var us = users.ElementAt(0);
string titlenames = "number,";
string userAnswer = (us.userName + ",");
foreach (string ss in List)
{
// Do stuff
}
foreach (string ans in us.answer)
{
// Do stuff
}
using (StreamWriter sw = new StreamWriter("Results.csv", true, Encoding.UTF8))
{
sw.WriteLine(titlenames);
sw.WriteLine(userAnswer);
}
this.Close();
}
感谢您的时间和帮助!
这是具有不同类型编码的 CSV 文件:
number לוי סל רמי שופר ×ב×לה ×‘×•× ×œ×œ×•× ×” פ×רק
22 FALSE TRUE FALSE FALSE TRUE TRUE FALSE FALSE
number לוי סל רמי שופר ×ב×לה ×‘×•× ×œ×œ×•× ×” פ×רק
33 TRUE TRUE FALSE FALSE FALSE FALSE TRUE FALSE
number +BdwF1QXZ- +BeEF3A- +BegF3gXZ- +BekF1QXkBeg- +BdAF0QXQBdwF1A- +BdEF1QXQ- +BdwF3AXVBeAF1A- +BeQF0AXoBec-
22 FALSE FALSE FALSE TRUE TRUE TRUE FALSE TRUE
number ÜÕÙ áÜ èÞÙ éÕäè ÐÑÐÜÔ ÑÕÐ ÜÜÕàÔ äÐèç
33 TRUE TRUE FALSE TRUE FALSE TRUE TRUE FALSE
number ÜÕÙ áÜ èÞÙ éÕäè ÐÑÐÜÔ ÑÕÐ ÜÜÕàÔ äÐèç
44 not answered not answered FALSE not answered not answered not answered not answered not answered
number ??? ?? ??? ???? ????? ??? ????? ????
55 not answered not answered not answered not answered not answered not answered not answered not answered
如您所见,乱码应该是阿拉伯语和希伯来语的名称。