Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6772863
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T15:35:56+00:00 2026-05-26T15:35:56+00:00

in my .net code i’m using byte[] bytesToSend = System.Text.Encoding.UTF8.GetBytes(partialtorender); then m writin it

  • 0

in my .net code i’m using

byte[] bytesToSend = System.Text.Encoding.UTF8.GetBytes(partialtorender);

then m writin it to excel

the text in “Hindi” Language is coming gibberish in generated excel, can you please suggest what to do?

System.IO.MemoryStream memStr = new System.IO.MemoryStream();

memStr.Write(bytesToSend, 0, bytesToSend.Length);

 memStr.Position = 0;

FileStreamResult result1 = new FileStreamResult(memStr, "application/ms-excel");

Response.AddHeader("content-disposition", "attachment; filename=" + "newExcelSheet" + ".xls");

return result1;
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T15:35:56+00:00Added an answer on May 26, 2026 at 3:35 pm

    Try emitting an UTF-8 preamble to indicate the correct encoding to Excel. Also .xls is a proprietary binary format. You cannot just use a string variable as in your code.

    Here’s an example with a CSV file export:

    public ActionResult Index()
    {
        var csv = "मानक हिन्दी;some other value";
        var data = Encoding.UTF8.GetBytes(csv);
        data = Encoding.UTF8.GetPreamble().Concat(data).ToArray();
        var cd = new ContentDisposition
        {
            Inline = false,
            FileName = "newExcelSheet.csv"
        };
        Response.AddHeader("Content-Disposition", cd.ToString());
        return File(data, "text/csv");
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

using VB.Net Code If e.Modifiers = Keys.Control And e.KeyCode = Keys.Enter Then If textbox1.Focus()
I have VB.NET code in Visual Studio 2008 using an obsolete method and would like to
I am using vb.net code. I have grid view, please see the code below:
I have ASP.Net code generating my button's HTML for me using divs to get
I have some VB.net code that inserts data into my SQL database using a
First .NET code compiles to MSIL and then JIT convert it to machine dependent
I am writing vb.net code to log a user into my application using SQL
I am writing vb.net code to log a user into my application using SQL
I am using vb.net code in which I am having a gridview control. Please
I am using vb.net code and sql server 2005. I have textbox in my

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.