Character Encoding mismatch

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • sixfortyfive
    Junior Member
    • Apr 2004
    • 21

    #1

    Character Encoding mismatch

    I get the following warning from the W3C HTML validator. I'm a Web designer, so I'd like my page to validate without any warnings. Can someone tell me how to solve this?

    Character Encoding mismatch!

    The character encoding specified in the HTTP header (utf-8) is different from the value in the <meta> element (iso-8859-1). I will use the value from the HTTP header (utf-8) for this validation.
  • ZYV
    Senior Member
    • Sep 2005
    • 315

    #2
    You first need to decide if your webpage will actually use UTF-8 or ISO. If it's UTF-8, you need to adjust the <meta> tag on that page, if it's ISO, then you need to create an .htaccess file and populate it with the following line:

    Code:
    AddDefaultCharset ISO-8859-1
    HTH

    Comment

    • sixfortyfive
      Junior Member
      • Apr 2004
      • 21

      #3
      I'm shooting for ISO. I've added that line to my .htaccess, but I still get the warning from the W3C:
      http://validator.w3.org/check?verbose=1&uri=http%3A%2F%2Fwww.kylehaskins.c om%2F


      All my pages have this META tag:
      Code:
      <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
      Why isn't this working?

      Comment

      • ZYV
        Senior Member
        • Sep 2005
        • 315

        #4
        I copied your webpage to a local subdirectory, created an .htaccess with this line and it works.



        So 1) you did something wrong 2) your host doesn't allow you to customise your Apache.

        P.S. I supposed that this page is hosted at Dathorn, so you are allowed to use local .htaccess with custom Apache settings. Nevertheless, from looking at the response headers, I see that probably it isn't. If it's the case your best bet is to call for support so they can change the default character encoding for your domain.
        Last edited by ZYV; 02-10-2008, 02:06 AM.

        Comment

        • ZYV
          Senior Member
          • Sep 2005
          • 315

          #5
          P.P.S. Please disregard my last post. I just couldn't help myself giving up on this investigation. I see that cpanel50 has slightly different Apache settings so I withdraw my point about not being hosted at Dathorn.

          Anyway, your journal is powered by Movable Type, while those about/contact things are simple stand-alone PHP-scripts.

          If you validate the latter before and after having uploaded my .htaccess you will see that it actually works. Therefore I suspect that Movable Type overrides Apache Content-Type setting by issuing somewhere a custom header(); command.

          Having that said, the solution for the journal part of your website would be

          1) To tweak Movable Type so it issues the correct ISO-8859-1 encoding
          2) Or edit your template to use UTF-8.

          I highly recommend you the second solution, because if you would ever need to use some national or accented characters (like résumé or привет) you will never end up with some weird encoding translation problems. And it won't cost you a dime. Contrary, ISO-8859-1 is less flexible and prone to the problems with national alphabets.

          Finally, congratulations for your website. It's just unbelievably cool, I wish I were that talented so I could amaze my friends with my home page. Unfortunately I'm just a programmer and nobody tends to understand the things I can amaze with LOL.

          Comment

          • sixfortyfive
            Junior Member
            • Apr 2004
            • 21

            #6
            ZYV-

            Thanks for your help. You were right, Movable Type has a character encoding built into the application. I did some research, and found that if I replaced the meta tag with the following one, I could see what the system was using.

            Code:
            <meta http-equiv="Content-Type" content="text/html; charset=<$MTPublishCharset$>" />
            Turns out that the default encoding for MT4 is utf-8, so I'll use that for all my pages.

            Thanks for the compliment on my design. I have the opposite problem - there are lots of backend things I'd like to do, but don't have the expertise.

            Comment

            • ZYV
              Senior Member
              • Sep 2005
              • 315

              #7
              OK, glad that you sorted it out

              Z.

              Comment

              Working...