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 989957
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T05:52:23+00:00 2026-05-16T05:52:23+00:00

I have a DataTable that I’m creating an XML file from using .WriteXML(..), although

  • 0

I have a DataTable that I’m creating an XML file from using .WriteXML(..), although I have a problem with it exporting in UTF-16 encoding and there seems to be no apparent way of changing this. I understand that .NET uses UTF-16 internally within strings, is this correct?

I’m then running the XML that DataTable.WriteXML() produces through an XSLT that includes the following in the output declaration:

<xsl:output method="xml" indent="yes" encoding="utf-8" />

But still, the output from the transformation is in UTF16, and the system I am trying to input this XML file into doesn’t support UTF16.

Is there any way to force the output to UTF-8?

  • 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-16T05:52:24+00:00Added an answer on May 16, 2026 at 5:52 am

    The encoding of the result-document is determined by the encoding attribute of the <xsl:output> instruction — not by the XML declaration of the XML document that contains the XSLT transformation.

    Here is an example:

    <xsl:stylesheet version="1.0"
     xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
     <xsl:output encoding="utf-8"/>
    
     <xsl:template match="/">
       <t>Hello, world!</t>
     </xsl:template>
    </xsl:stylesheet>
    

    when applied on any XML document (not used in this simple demo), the result wanted is produced:

    <?xml version="1.0" encoding="utf-8"?><t>Hello, world!</t>
    

    Do note: In .NET you might need to specify particular settings of the XmlWriter passed as parameter to the XslCompiledTransform.Transform() method. See this for details how to specify the wanted encoding in the XmlWriterSettings class.

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

Sidebar

Ask A Question

Stats

  • Questions 530k
  • Answers 530k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer To check for undefined: if (typeof x !== 'undefined') {… May 16, 2026 at 11:34 pm
  • Editorial Team
    Editorial Team added an answer I think this is a good example of the dynamic… May 16, 2026 at 11:34 pm
  • Editorial Team
    Editorial Team added an answer Yes, it's an initialization issue. this does not refer to… May 16, 2026 at 11:34 pm

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

Related Questions

I have a DataTable that is filled in from an SQL query to a
I have a DataTable that I manually created and loaded with data using C#.
I have a datatable in memory that I got from a non SQL source.
I have a DataTable that queries out something like below usergroupid...userid......username 1.............1...........John 1.............2...........Lisa 2.............3...........Nathan
I have a DataTable that has a boolean column called [Invalid]. I need to
I have a datatable that has a date column, but I am stumped as
I have a DataTable that contains 3 fields: ACount , BCount and DCount .
I have a DataTable that I have populated via the Dataset.ReadXML() method. I am
I have a DataTable that has several DataColumns and DataRow. Now i would like
I have a datatable that contains simple Key Value pair how do I return

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.