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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T03:13:14+00:00 2026-06-01T03:13:14+00:00

I’m having the craziest issue with Firefox. I’m not sure if this issue is

  • 0

I’m having the craziest issue with Firefox. I’m not sure if this issue is coming from Firefox its self, or from my custom web server (built in Delphi) or what it might be. This problem only happens in Firefox (and Opera) where it is both moving everything from the head down to the body, and also adding random characters at the beginning of the body. Strangely, it even does it with a completely 100% empty web page.

I’m testing with a page as simple as this:

<html>
<head>
    <title>Test</title>
</head>
<body>

</body>
</html>

As for the Web Server, I’m building a custom HTTP App in Delphi using IdHTTPWebBrokerBridge (Indy) and simply replacing the ContentStream (or Content) of the Request like so…

procedure TDashModule.DashConsoleHomeAction(Sender: TObject;
  Request: TWebRequest; Response: TWebResponse; var Handled: Boolean);
begin
  Response.ContentType:= 'text/html';
  Response.ContentStream:= TFileStream.Create('C:\SomeDir\SomeFile.html', fmOpenRead or fmShareDenyNone);
end;

…where SomeFile.html is the empty page as posted above, and the procedure being an event handler for the default request handler.

In Chrome, IE, Safari, etc. everything shows exactly as the original code. However, Firefox (and Opera) are producing this:

<html>
<head>
</head>
<body>

<title>Test</title>
</body>
</html>

As you can see, the title tag has been moved down to the body, and some random characters  are appearing at the very beginning of the body. When viewing the raw page as its original file in Firefox, it shows correctly. But when using my web server in Delphi, Firefox is destroying this page (and all pages, for that matter).

What could be doing this and how to fix it?

Steps to reproduce

A) Create a new HTML Page (for me in Visual Studio 2010) with just this content:

<html>
<head>
    <title>Test</title>
</head>
<body>

</body>
</html>

B) In Delphi XE2, start a new project: File > New > Other... > Web Broker > Web Server Application

C) Choose Stand-alone VCL Application > Next > Finish

D) Create a default handler (Right-click WebModule1 and choose Action Editor...)

E) For DefaultHandler item, go to the Event Properties and go to the Event Handler for OnAction

F) Replace any code that’s already there with this (replace filename with HTML filename):

Response.ContentStream:= TFileStream.Create('C:\SomeDir\SomeFile.html', fmOpenRead or fmShareDenyNone);

E) Run application and click “Show In Browser” – copy/paste the URL to Firefox if necessary.

UPDATE

Thanks to the help, I’ve come to realize the issue is with the BOM tag of the file, which did not belong there. It was due to how the TFileStream works, it loads every little piece of the file, which included this code. I’ve changed my method to using TStringList.LoadFromFile() instead, because this automatically detects it and I can also read TStringList.Text to assign to Response.Content.

  • 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-01T03:13:16+00:00Added an answer on June 1, 2026 at 3:13 am

    Apparently those three characters constitute a Unicode UTF-8 Byte-Order Mark. They’re supposed to be placed at the start of a file and not actually get rendered; they’re metadata to let the text interpreter know the encoding that’s being used. No idea why you’re seeing one in the middle of your file, though! Try opening the original in a hex editor and seeing if it’s got a BOM embedded in it.

    (In case you don’t have a hex editor, you can get a very good free one here. It’s even written in Delphi!)

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

Sidebar

Related Questions

link Im having trouble converting the html entites into html characters, (&# 8217;) i
For some reason, after submitting a string like this Jack’s Spindle from a text
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
Does anyone know how can I replace this 2 symbol below from the string
I am currently running into a problem where an element is coming back from
I'm having trouble keeping the paragraph square between the quote marks. In firefox the
That's pretty much it. I'm using Nokogiri to scrape a web page what has
this is what i have right now Drawing an RSS feed into the php,
I have this code to decode numeric html entities to the UTF8 equivalent character.

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.