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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T22:19:18+00:00 2026-05-22T22:19:18+00:00

I have a C# app that makes a call out to a cold fusion

  • 0

I have a C# app that makes a call out to a cold fusion web service (well it resembles a web service). This service returns 1252 encoded XML format, and characters passed a certain range come encoded like this: ˜. That is one of the characters that actually comes back. I know the actual text value for this is “˜” in codepage 1252 because I can see the value in the original format in the database.

I take the raw XML from the service and feed it into an XmlTextReader like this:

// turn our raw xml into a reader
byte[] responseBytes = UTF8Encoding.UTF8.GetBytes(rawXml);
MemoryStream responseStream = new MemoryStream(responseBytes);
state.XmlResponseReader = XmlTextReader.Create(
    responseStream,
    new XmlReaderSettings { IgnoreWhitespace = true });

Further down I call state.XmlResponseReader.Read(). When I do these hex encoded values are removed from the text entirely. So the following text: "˜hi there" will show up as “hi there”. I want to get “~hi there”.

I have tried quite a few different things to try and get these values to get decoded into their text equivalent but nothing has worked.

Manually I can get the correct value by taking the hex value (98), converting it to decimal (152). then doing this: Encoding.GetEncoding(1252).GetString(new byte[] {152}). However, that being entirely manual is less desireable. Does anyone know of a way I can get this converted using more streamlined functionality in the .Net framework?

  • 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-22T22:19:19+00:00Added an answer on May 22, 2026 at 10:19 pm

    In the end I didn’t find a way to get the XmlTextReader to autodecode the data but I did find the next best thing. Using ReadChars (which isn’t available on XmlReader) I was able to retrieve the data from the InnerText of my XML node without having those characters corrupted resulting in loss of data.

    Here is my code:

    int readCharacters = 0;
    short bufferSize = 40;
    char[] buffer = new char[bufferSize];
    StringBuilder innerString = new StringBuilder();
    
    do
    {
        readCharacters = reader.ReadChars(buffer, 0, bufferSize);
    
        innerString.Append(buffer, 0, readCharacters);
    
    } while (readCharacters != 0);
    

    This allows me to get back my raw data example(—˜) at which point I can manually take 97 and 98 out of that string, convert them to a decimal, then to an ascii character. So the solution is still at least 1/2 manual but the ReadChars has saved me some up front whole-string manipulation that would have otherwise been necessary to facilitate the manual steps.

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

Sidebar

Related Questions

I have a GWT app that makes an RPC call to a server to
I have this method in App Delegate that makes a window and content view
I have an app that can make modify images. In some cases, this makes
I have a java web app that makes back-end use of a third-party web
We have a C# client app that communicates to our C# backend service via
I have a C# Winforms application that makes a call to a COM class.
I have this project in which i am calling a web service, receiving rates
I have a mobile app that I targeted for iOS and Android. It makes
I am building an AIR app that makes a call to a remote server
I have a Java app that makes use of some native code, and it's

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.