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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T10:08:16+00:00 2026-06-11T10:08:16+00:00

I have a web app that creates some HTML as a String and uploads

  • 0

I have a web app that creates some HTML as a String and uploads the String as a file to Amazon S3.

Checking the String in the debugger right before the file is uploaded I see the HTML looks fine but when I check the file in the bucket I see some characters have changed. It only happens to certain characters. For example:

It’s GO time on Android™!

becomes

It’s GO time on Android™!

This is the exact code I use:

using (var client = AWSClientFactory.CreateAmazonS3Client(accessKey, secretKey, s3Config))
        {
            var request = new PutObjectRequest()
                .WithBucketName(bucketName)
                .WithKey(fileKey)
                .WithMetaData("title", title);
            request.ContentBody = body;
            S3Response response = client.PutObject(request);
            response.Dispose();
        }

I tried .WithContentBody(body) but changed it to request.ContentBody = body; to see if that would magically work but obviously it didn’t.

The body variable is the HTML String. When I view it in the Debugger the characters look as they should. Also when I use the Visual Studio HTML viewer for the body value it looks fine.

Any idea what I could be doing wrong here? Am I missing some setting? Can’t seem to find any body else with this problem in my web searches.

  • 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-11T10:08:18+00:00Added an answer on June 11, 2026 at 10:08 am

    Finally figured this one out. Didn’t spot it sooner because the HTML string I had in the debugger was rendering OK in browsers but it should have been obvious I guess.

    I have to encode special characters before transporting them. I couldn’t use the standard HttpUtility to encode the entire HTML string because all the HTML tags would get encoded.

    I used this method:

    private static string HtmlEncodeSpecialChars(string html)
        {
            var sb = new StringBuilder();
            foreach (var c in html)
            {
                if (c > 127) // special chars
                    sb.Append(String.Format("&#{0};", (int)c));
                else
                    sb.Append(c);
            }
            return sb.ToString();
        }
    

    which I saw here.

    Seems to be doing the trick so far.

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

Sidebar

Related Questions

I have an MVC2 C#. Net web app that is storing data in html
In my web app, the user can create some HTML/CSS markup that is saved
I have a web app that runs fine in Visual web developer. But when
I have a web app that reads data from a SQL DB that contains
I have a web app that has a big and complex form (fields, checks,
We have an web app that is talking to Netsuite via Netsuite's web services.
I have a web app that I've recently applied a jQuery ThemeRoller theme to.
I have a web app that lets a client define a daily rate for
We have a web app that we update and release almost daily. We use
I have a web app that uses the Active Directory Membership Provider and when

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.