简体   繁体   English

将日文字符输入CSV文件(C#)

[英]Input Japanese characters into CSV file (C#)

I want to write Japanese strings (”設定" ”HELLO” "設定") as a record into CSV file. 我想将日语字符串(“设置”“ HELLO”“设置”)作为记录写入CSV文件。

I tried to do with this code but displayed incorrectly: 我尝试使用此代码,但显示不正确:

StreamWriter sw_CSV = new StreamWriter(CSvFileName, false, System.Text.Encoding.Unicode);
sw_CSV.WriteLine("設定,HELLO,設定");
sw_CSV.Close();

Thanks, 谢谢,

It should be fine, you just need to set encoding then you're opening file.. 没关系,您只需要设置编码即可打开文件。

here is an example (I'm using OpenOffice here): alt text http://img81.imageshack.us/img81/1299/japanesecsv.jpg 这是一个示例(我在这里使用OpenOffice): 替代文本http://img81.imageshack.us/img81/1299/japanesecsv.jpg

尝试将编码更改为UTF-8

StreamWriter sw_CSV = new StreamWriter(CSvFileName, false, System.Text.Encoding.UTF8);

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM