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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T11:36:23+00:00 2026-05-16T11:36:23+00:00

I am working on a simplistic website using PHP, a language I haven’t touched

  • 0

I am working on a simplistic website using PHP, a language I haven’t touched in a long time, especially when it’s running on a Windows system from WebMatrix. Lately I’ve been porting a couple of websites from ASP.NET (Umbraco) to PHP to a basic templating class written in PHP, and so far things have been going fairly well, until some unicode characters started appearing in my source before the DOCTYPE. The Mozilla source checker doesn’t show these, but when posted into Notepad two unicode boxes/characters are shown.

I have looked at the problem in Firebug and it seems to believe that all JavaScript is running within the body tag, even though a quick look at the source code shows that this is not the case.

The same source code works perfectly when run in ASP.NET from WebMatrix, but this revised website using the code below in PHP doesn’t want to work properly. Here is the code I am using, starting with a typical page file.

<?php
include "./template.class.php";

$content = "<p>Test.</p>";

$template = new Template;
$template->load("./design.php");
$template->replace("title", "Title");
$template->replace("ContentTitle", "Test");
$template->replace("PageContent", $content);
$template->publish();
?>

Here is the template class I am using.

<?php
class Template {
    var $template;

    function load($filepath) {
        $this->template = file_get_contents($filepath);
    }

    function replace($var, $content) {
        $this->template = str_replace("@$var@", $content, $this->template);
    }

    function publish() {
        eval("?>".$this->template."<?");
    }
}
?>

As shown, the design page is used for each page, with the necessary fields listed with the at-symbol (e.g. <title>@title@</title>).

I am fairly sure that the CSS and HTML isn’t to blame as I am using what is largely the same code on other websites with no problems whatsoever.


EDIT: The problem has been discovered, but in doing so it’s shown that editing PHP files in the new WebMatrix editor from Microsoft will continuously cause the Byte Order Mark to appear when a PHP file is saved. As mentioned already Notepad++ is extremely efficient at sorting this problem out and if you have the same problem open all necessary files and go to Encoding in the top menu and click “Convert to UTF-8 without BOM”. Once saved the problem should disappear.

I’m of the opinion that this is a valid bug in the WebMatrix tool, and I’d be more than happy to submit the bug if my company Internet wasn’t restricted when it comes to Windows Live. If you do happen to see it posted as a bug or do so yourself then please comment on this post as even with its flaws the WebMatrix tool is a fantastic little editor for ASP.NET Razor and PHP.

  • 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-16T11:36:23+00:00Added an answer on May 16, 2026 at 11:36 am

    This is most likely a BOM. Try to find the file that prepends it (it could be one of the PHP includes) and set your editor to save the files without it.

    See this question for a number of approaches to remove it.

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

Sidebar

Related Questions

Working on a small game using an HTML5 canvas, and javascript. And it's working
Working with MS Access for the first time and coming across a few problems
Working on a project using Entity Framework (4.3.1.0). I'm trying to figure out how
Working on a website http://www.ArenaText.com written in asp.net with Microsoft AJAX control toolkit. iPad
I am trying to a save a website to an HTML file using Ruby.
working on using a formula ive been using for a while to find distances
I'm working on a site where users can describe a physical object using (amongst
Background I am working on a legacy small-business automation system (inventory, sales, procurement, etc.)
I am trying to teach myself AI using neural networks. Long story short, I
I am attempting to create a very simplistic particle system for an Android application

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.