除了英语,我不能写任何阿拉伯语或希伯来语的Results.csv.
每次我试图写任何一个我都会得到乱码,在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
如你所见,gibbrish标记应该是阿拉伯语和希伯来语的名字.