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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T01:55:41+00:00 2026-06-18T01:55:41+00:00

I am trying to read an XML file content embedded in Multimedia Component through

  • 0

I am trying to read an XML file content embedded in Multimedia Component through templating(C#). The XML file contains few UTF-8 characters. When I read the xml content, the the output is translating the UTF-8 characters into some garbage characters(? symbols or rectangle boxes).
Below is the code snippet that I used in C# Templating.

Code 1:

Component xmlMultimediaComponent = (Component)XMLMMSRepositoryObject;
// read xml in multimedia component into a string
UTF8Encoding encoding = new UTF8Encoding();
byte[] binary = xmlMultimediaComponent.BinaryContent.GetByteArray();
string navXmlContent = (binary != null) 
               ? UTF8Encoding.UTF8.GetString(binary, 0, binary.Length) 
                       : string.Empty;           

Code 2:

using (MemoryStream ms = new MemoryStream())
{
  xmlMultimediaComponent.BinaryContent.WriteToStream(ms);
  ms.Seek(0, SeekOrigin.Begin);

  using (var streamReader = new StreamReader(ms, Encoding.UTF8))
  {                      
    string output = streamReader.ReadToEnd();
      ....
  }
}

In both of the above cases, the output is having garbage characters(for UTF-8 encoded).

Any idea how to get the same UTF-8 content into the string output from the XML file in Tridion multimedia component.

Note: The XML File in the multimedia component is saved with UTF-8 encoding.

Thanks in advance.

  • 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-06-18T01:55:43+00:00Added an answer on June 18, 2026 at 1:55 am

    On further investigation, we noticed that the file associated in Multimedia component is ASCII encoded. So there must not be explicit conversion to UTF-8 while reading its contents, and it should go with default encoding(i.e, ASCII in above case).

           Component xmlMultimediaComponent = XMLMMSRepositoryObject as Component;               
           byte[] binary = xmlMultimediaComponent.BinaryContent.GetByteArray();
           string navContent = (binary != null) ? Encoding.GetEncoding("ASCII") : string.Empty;
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have an XML file as follows, and I'm trying to read the content
I am trying to read a XML file and display its content in a
Hi there I have been trying to read an xml file with UTF strings,
I am trying to read a utf-8 encoded xml file in python and I
I have one .net windows application I'm trying to read .xml file from c#
I am trying to read an XML file using objective C language and parse
I am trying to read in an XML file that I have saved to
I have an XML file that I'm trying to read from here , and
I'm trying to read data from an xml file and display it in a
I'm trying to read the data from an XML file, validating it against the

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.