Double Byte Characters conversion? RRS feed

  • Question

  • User1048192908 posted

    In our database we store values for a client in double byte characters (ex: 单伟平). The original characters are 单伟平 and most browsers display them without any coding. But when we export data to an excel document the double byte chars are being shown rather than 单伟平 

    How do I make it so when a user open the exported data in the excel it shows up as 单伟平. 

    I am using VB.NET 1.1


    Wednesday, January 15, 2014 2:42 PM


  • User-933407369 posted


    since your data from database and those  can show on page, i would suggest bind the data to GridView, and export the data from gridview.

          <div><input id="S" value="&#21333;&#20255;&#24179;" />
              <asp:TextBox ID="TextBox1" runat="server" Text="&#21333;&#20255;&#24179;"></asp:TextBox>

    please refer to the link :Export gridview data to Excel/word document in asp.net C#

    if you don't want to do it, you try to use UTF-8 .

    UTF-8 supports 8-bit data sizes and works well with many existing operating systems. For the ASCII range of characters, UTF-8 is identical to ASCII encoding and allows a broader set of characters. However, for Chinese-Japanese-Korean (CJK) scripts, UTF-8 can require three bytes for each character, and can potentially cause larger data sizes than UTF-16. Note that sometimes the amount of ASCII data, such as HTML tags, justifies the increased size for the CJK range.

    Please refer to the link below for details:

    Character Encoding in the .NET Framework


    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Thursday, January 16, 2014 5:25 AM