Not signed in (Sign In)

SkillShare - A place to discuss Web Standards and Web Design topics

Categories

Vanilla 1.1.5a is a product of Lussumo. More Information: Documentation, Community Support.

  1.  permalink
    How do you declare charset utf-8 in xhtml 1.0 strict and have it work in IE without messing up your encoding?
    •  
      CommentAuthoranblik
    • CommentTimeFeb 26th 2006
     permalink
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
    <head>
    <title>website name</title>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    .....................
    .....................

    yes it worked in IE.
  2.  permalink
    You should really be setting your character set in an htaccess file or in Apache directly.

    The reason for that is, what character encoding does the document have before it reaches '<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />'?

    Also, if you transport the document somewhere and want to change character sets, you just change one file for all documents.
  3.  permalink
    that doesn't work anblik.

    How do I go about it your way Nick?
  4.  permalink
    You just add this into your htaccess file:

    AddDefaultCharset utf-8

    You can replace utf-8 with whatever character set you want.
  5.  permalink
    Hmm, that didn't work either. I'm not entirely sure why IE doesn't switch to utf-8 encoding.

    Look at :
    http://onemanshortproductions.com

    In a gecko based browser and then in IE... IE displays weird characters
  6.  permalink
    Well the file was originally UTF-8 w/o BOM, So i saved it as UTF-8. That seemed to fix it in IE. =|
    •  
      CommentAuthoranblik
    • CommentTimeFeb 27th 2006
     permalink
    mr. fahrenheit,

    you can follow nick1presta comment. He shows you right direction.

    HTTP charset: Mozilla supports server-generated HTTP charset correctly. (The order of priority is: HTTP charset > Document Meta Charset > Browser Menu choice.) However, if you’re going to say you’re using XHTML, then please make sure you use it properly. This is where most people and browsers fall down.

    Setting Mimetype application/xhtml+xml headers in PHP
    ============================================
    In some special cases, before sending HTML META Tags header you need to send HTTP Header first. Something like this:


    <?php
    include('header.php');// contains the above function
    set_header();
    ?>
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
    <head>.... etc

    I am not going to rewrite/duplicate the code which is already written by someone else. Please refer this, this is going to help you out and solve your charset issues.:

    http://www.workingwith.me.uk/articles/scripting/mimetypes
    or,
    http://techpatterns.com/forums/about138.html
  7.  permalink
    Yes, you need to send the correct headers to get an XHTML document.

    http://infinity-stuff.com/lab/html/xhtml.php
    • CommentAuthorJero
    • CommentTimeFeb 27th 2006 edited
     permalink
    Try an XML processing instruction:

    <?xml version="1.0" charset="UTF-8"?>
  8.  permalink
    I had that on when I originally had the problem... also I had to use a php echo to even use that ...
  9.  permalink
    using that php code I was able to forget about even using meta types! Coolies.
    •  
      CommentAuthornifkin
    • CommentTimeFeb 28th 2006
     permalink
    Try an XML processing instruction:
    <?xml version="1.0" charset="UTF-8"?>


    While that's totally valid, it also sends some versions of IE into quirks mode and hoses the box model (as does any code or comment before the DOCTYPE declaration).

    (Also, depending on how PHP may be configured that could trigger the PHP parser into thinking it's a command and throwing PHP errors.)
    •  
      CommentAuthoranblik
    • CommentTimeFeb 28th 2006
     permalink
    yes nifkin, it is better to work in standard mode.
  10.  permalink
    so I should exclude the xml declaration for the browsers that I send as text/html? ... namely IE?
    •  
      CommentAuthornifkin
    • CommentTimeFeb 28th 2006 edited
     permalink
    Including it in IE causes problems there. Excluding it anywhere else does no harm. Whatever decision you choose to make based on that is up to you and pretty much purely a matter of personal preference (at least for now).
  11.  permalink
    Yeah, I've excluded it from IE. I'm pretty content with my coding now. I need to condense and fix my css, tidy it up... and get it to work correctly in IE. If anyone is willing to help me out, that'd be great ;)
Add your comments
    Username Password
  • Format comments as (Help)