Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 5 of 5
  1. #1
    New Coder
    Join Date
    Sep 2007
    Posts
    50
    Thanks
    16
    Thanked 0 Times in 0 Posts

    Character encoding help

    My PHP file is giving me the dreaded "The character encoding of the HTML document was not declared" error.

    I added the following in my header section but it didn't help.

    PHP Code:
    <meta content="text/html;charset=utf-8" http-equiv="Content-Type">
    <
    meta content="utf-8" http-equiv="encoding"
    Thanks for any help...

  • #2
    Senior Coder
    Join Date
    Jan 2011
    Location
    Missouri
    Posts
    4,297
    Thanks
    23
    Thanked 612 Times in 611 Posts
    giving me the dreaded
    Sounds like this is happening all the time. Personally I have never seen it.

    Don't think that is coming from php, but your html is having trouble with the php feedback(?) Post the php code here or at lest what your echoing back.

  • #3
    New Coder
    Join Date
    Sep 2007
    Posts
    50
    Thanks
    16
    Thanked 0 Times in 0 Posts
    See attachment. This is from Firefox's web console debugging tool. And yes, most of my .php pages show this error.
    Attached Thumbnails Attached Thumbnails Character encoding help-00.jpg  

  • #4
    Senior Coder Arbitrator's Avatar
    Join Date
    Mar 2006
    Location
    Splendora, Texas, United States of America
    Posts
    3,302
    Thanks
    28
    Thanked 276 Times in 270 Posts
    Quote Originally Posted by frank727 View Post
    See attachment. This is from Firefox's web console debugging tool. And yes, most of my .php pages show this error.
    The easiest way to specify the encoding of all of your HTML documents is to declare it site-wide using an HTTP header; just make sure every document actually conforms to that encoding. For example, if using Apache, you can put AddType UTF-8 .html in a .htaccess file to specify that the encoding of all HTML files with that particular extension is UTF-8.

    Quote Originally Posted by frank727 View Post
    PHP Code:
    <meta content="text/html;charset=utf-8" http-equiv="Content-Type">
    <
    meta content="utf-8" http-equiv="encoding"
    The second line is not a correct way to specify encoding. The HTML4/5 way to do it is via the first line. The HTML5-specific way is through <meta charset="UTF-8">.
    For every complex problem, there is an answer that is clear, simple, and wrong.

  • Users who have thanked Arbitrator for this post:

    frank727 (03-18-2013)

  • #5
    New Coder
    Join Date
    Sep 2007
    Posts
    50
    Thanks
    16
    Thanked 0 Times in 0 Posts
    Thanks...


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •