encoding issue

10,561

Solution 1

That's a BOM character, which is there because the source code files are saved as UTF-8 BOM. Try to save them as UTF-8 no-BOM (or whatever your editor calls it) or indeed ISO-8859-1 if you must use it (...why would you?).

Solution 2

If you want to use iso-8859-1, you need to save your PHP file as iso-8859-1.
For detailed instructions, please tell us which editor you're using.

However, I highly recommend that you use UTF8 instead.

Share:
10,561
rlc
Author by

rlc

Computer Science student at Federal University of Pernambuco

Updated on July 24, 2022

Comments

  • rlc
    rlc over 1 year

    I'm developing a website using PHP and these strange chars "" appears in my page, right on the top of it. My code is this:

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><?php echo '';?>
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
    

    But when I see the source code in the browser, it shows this:

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
    

    I don't know if has any relation to the encoding I'm using, because when I change the charset to charset=utf-8 it disappears but I must use iso-8859-1

  • rlc
    rlc over 13 years
    Mozilla Firefox says it's using iso-8859-1
  • clee
    clee over 13 years
    It depends on the editor you're using. So... what editor are you using?
  • rlc
    rlc over 13 years
    I have already configured Eclipse for that, and it still appears.
  • Gromski
    Gromski over 13 years
    @Rafael Sorry, I can't tell you how to do that in Eclipse. Look at the documentation how to set a files encoding.
  • mshthn
    mshthn about 12 years
    Oh man. You've saved my life with that. Saving the file as an ANSI one solved my problem.
  • raina77ow
    raina77ow over 11 years
    Don't you think that OP did place the code right? Why didn't you check the answer that was accepted (as it - obviously - described the problem and its possible solution quite correctly)?