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

  • SEARCH
  • Home
  • 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 900399
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T15:22:53+00:00 2026-05-15T15:22:53+00:00

As per question how to i create a a file that also includes the

  • 0

As per question how to i create a a file that also includes the Byte Order Mark?

Having some trouble displaying some chars because the csv viewer cannot display the chars correctly without the BOM.

Appreciate any help.

EDIT To Include code:

string attachment = string.Format("attachment; filename=results_{0}_to _{1}.csv", startDate.ToString("MM_yy_yyyy"), endDate.ToString("MM_yy_yyyy"));
HttpContext.Current.Response.AddHeader("content-disposition", attachment);
HttpContext.Current.Response.ContentType = "text/csv";
HttpContext.Current.Response.AddHeader("Pragma", "public");

string content = GetTextFromDB();

HttpContext.Current.Response.Write(content);
HttpContext.Current.Response.End();
  • 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-15T15:22:53+00:00Added an answer on May 15, 2026 at 3:22 pm

    This should be done automatically for any of the inbuilt code using an Encoding, such as StreamWriter – just make sure that the encoder you pass in is configured to include a bom (the default Encoding.UTF8 includes the bom).

    If you are handling your own Encoding -> Stream logic, then you need to call .GetPreamble() and write those bytes at the start of the stream.

    The default Encoding.UTF8 includes the preamble; but you can do it explicitly in the ctor: new UTF8Encoding(true)

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am having the same issues as per this question: WCF not deserializing JSON
So, as per a separate question that I asked I'm using the following code
As per question says. Specifically i want the html.beginform() to have the runat=server attribute.
Per this question (see comments near the bottom), I was wondering if anyone knows
As per the question. In the debug view, there's the Variables frame. It shows
This is not a programming question per se, although the ultimate goal is to
I've started to become a Good Citizen, as per this question here: Domain compatibility:
I would like to start a community discussion. As per my question, when do
Per a great answer from another question I have begun mounting global resources (css/js/images)
As per the title I have three parts to this question... Is db4o object

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.