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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T19:58:25+00:00 2026-05-28T19:58:25+00:00

I am trying to publish articles written in Word on a website as html,

  • 0

I am trying to publish articles written in Word on a website as html, I have a windows client that will convert the article to html and ship the html to a folder on the website, I then show the article in an IFrame. However in IE9 the images won’t show because IE9 tries to convert them to vector graphics. I decided to remove the code from the html that’s responsible for this and here starts my problem. After I modify and save the file I get garbage characters and these are displayed on the webpage too. However if I manually edit the file in notepad++ I don’t get the same issues, How can I read a file saved in word as html using C# and not get these garbage chars?? here is my code

    private bool AdjustHtmlPageForIE9Images(FileInfo file)
    {
        bool success = true;
        try
        {
            string content = File.ReadAllText(file.FullName);
            //replace [if gte vml 1] with [if gte iesucksopd 1]
            content = content.Replace("[if gte vml 1]", "[if gte iesucksopd 1]");
            //replace [if !vml] with [if !iesucksopd]
            content = content.Replace("[if !vml]", "[if !iesucksopd]");
            //now write the file over
            File.WriteAllText(file.FullName, content);
        }
        catch (Exception ex)
        {

            throw ex;
        }
        return success;
    }

and this causes some garbage chars to be displayed.

Hi guys thanks for all the responses here is what I did to fix this

Hi Guys thanks for the responses finaly got it going, I had to open in FF and check the encoding and it was Western Windows-1252, then as SLaks sed pass GetEncoding(1252) in read and write operations here is the revised code.

    private bool AdjustHtmlPageForIE9Images(FileInfo file)
    {
        bool success = true;
        try
        {
            Encoding encoding = Encoding.GetEncoding(1252);
            string content = File.ReadAllText(file.FullName,encoding);
            //replace [if gte vml 1] with [if gte iesucksopd 1]
            content = content.Replace("[if gte vml 1]", "[if gte iesucksopd 1]");
            //replace [if !vml] with [if !iesucksopd]
            content = content.Replace("[if !vml]", "[if !iesucksopd]");
            //now write the file over
            File.WriteAllText(file.FullName, content, encoding);
        }
        catch (Exception ex)
        {

            throw ex;
        }
        return success;
    }

Isn’t it just ridiculous that IE9 can’t do such a simple thing as display html from word in an IFrame no wonder it’s popularity keeps falling.

  • 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-28T19:58:27+00:00Added an answer on May 28, 2026 at 7:58 pm

    You need to explicitly pass the encoding to ReadAllText and WriteAllText; otherwise, it will default to UTF8.

    Pass Encoding.GetEncoding(1252).

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

Sidebar

Related Questions

I written one WCF service after that i am trying to Publish(after Build) this
* strong text *I have a website that publishes articles every day. I want
I'm trying to publish my website to a local folder. I have two websites
I am trying to publish a WCF service that sends to a NSB host.
I'm trying to publish an asp.net website on a remote server. When my code
I'm trying to publish my program so that it can get updates and am
This is the output that I get from TFS Build when trying to publish
I am trying to modify a script that was developed to import article records
I've been trying to publish a read action for an article object to timeline,
Im trying to publish my site on an server and have been receiving this

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.