How to write a CSV file with Japanese characters?

Posted on 2005-04-08
Last Modified: 2010-04-16
Here is my code:

  System.IO.FileStream f = new System.IO.FileStream("C:\\temp.csv", System.IO.FileMode.Create);
  byte[] bytes = System.Text.Encoding.UTF8.GetBytes("あ");
  f.Write(bytes, 0, bytes.Length);

The character saved in CSV file is in Japanese style but is not the input character.

Could experts here show me the way to solve this problem?

Many thanks.
Question by:ehanoi2
    1 Comment

    Accepted Solution

    Dim m_stream As New System.IO.MemoryStream
    Dim output As String
    Dim writer As New System.IO.StreamWriter(m_stream, System.Text.Encoding.Unicode)

    Dim s1 As String = ApplicationResource.GetString("Header_PA5110_PartName")
    writer.Write(s1 & vbTab & s1 & vbTab & s1)

    Hope this helps!

    Featured Post

    6 Surprising Benefits of Threat Intelligence

    All sorts of threat intelligence is available on the web. Intelligence you can learn from, and use to anticipate and prepare for future attacks.

    Join & Write a Comment

    Introduction                                                 Was the var keyword really only brought out to shorten your syntax? Or have the VB language guys got their way in C#? What type of variable is it? All will be revealed.   Also called…
    Entity Framework is a powerful tool to help you interact with the DataBase but still doesn't help much when we have a Stored Procedure that returns more than one resultset. The solution takes some of out-of-the-box thinking; read on!
    Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.
    Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…

    754 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    18 Experts available now in Live!

    Get 1:1 Help Now