Hidden characters in Expression Web files

I tried a few times to install wordpress on my domain - elgincomputerguy.com. I kept getting weird errors. I’d clear the database and start again, but the same thing kept happening.

I finally went to the support forums and found other people having the same problem and one of the suggested answers said that the file must start with “<?php” - any blank lines or spaces will mess it up. That’s when I remembered that I’d edited the file with Microsoft Expression Web and it adds some kind of weird characters at the beginning of every file.

I just found out about that weirdness within Expression Web a couple of months ago. Here’s what the file looked like in notepad:

NotepadHere's how it looks in Notepad

and here’s how it looks when I go to the DOS prompt and use “edit”:

EDIT

Isn’t that weird? I love Expression Web - I switched from Dreamweaver several months ago, but this odd behavior makes me have second thoughts. This is the second time it bit me - both times while I was doing PHP. You’d think I would have caught it sooner!

Notice that Notepad doesn’t display the hidden characters. If you create the file in Notepad, they’re not there, but if you do it in Expression Web then open in Notepad, they won’t show, but if you modify the file in Notepad and save it - the hidden characters remain. The only way I know of to get rid of them once they’re in a file is to use the DOS prompt and EDIT.

Tags: , , ,

4 Responses to “Hidden characters in Expression Web files”

  1. Dan Cowsill Says:

    That’s kinda weird. Most editors used for programming go out of their way to make sure the only characters in the file other than the ones you explicitly type are the newline at the end…

    Any luck figuring it out? What you could do is open up a hex editor and look at the codes for the first few characters there. Match it against an ascii table and see if that means anything.

  2. admin Says:

    I found this:
    hi matt,
    this has to do with the BOM i suspect.

    To remove it from your CSS file:

    Open the file in EW - Right click in the file and choose Encoding

    In Save the current file as: dropdown choose Unicode (UTF-*) (or an
    encoding that you want)
    Clear the checkbox “Include a byte-order mark (BOM) when saving as
    Unicode - Click Save as… and overwrite the original file.

    A line like this @charset “utf-8″; will be added and the BOM
    removed.
    Obviously you should back up and test this first
    HTH
    JIM

    at this site:
    http://www.expression-web-designer-help.com/forum/printer_friendly_posts.asp?TID=532

    I ran into it before when working with PHP. If you double-click a PHP file in Expression web that has not been changed from the default (as mentioned above), you get these BOM characters. PHP doesn’t like them!

    Out of curiosity I opened an HTML file using the DOS editor and the characters are there, too. I guess I’d better change my default encoder to strip out those characters. NOTE: I’m currently set at the default.

    Randy

  3. Anonymous Says:

    free car quote…

    Excellent post. Keep it up!…

  4. davey Says:

    Thanks so much for the post. The idea of adding this to the top of each include file works.

    This from http://www.expression-web-designer-help.com/forum/printer_friendly_posts.asp?TID=532

    Thanks Again!!

    ——————————————–
    Yes,
    EW is adding a BOM to all the PHP pages, So if you are pulling PHP include files, try adding this to the head of each include file:

    This tricks EW into NOT adding the BOM, but doesn’t affect the browser in any way. Since EW will see the content type (even though it is commented out), it will not add the BOM. Also remember to put a content type on your regular page, as well; such as:

    As Jim says, you will also need to change the setting on your stylesheet.

    Good luck to anyone else who noticed this problem!
    ————————————————-

Leave a Reply