How to display diacritics in website?

Discussion in 'HTML & Website Design' started by dieorfly, Sep 13, 2009.

  1. #1
    Hello friends, I have a problem. I downloaded web template which I want to use for my website written in Slovak language. But when I try to write words with diacritics (for example: č, š, ž ect.) they don't display correctly on my website.

    I have UTF-8 as my charset like this:

    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">

    but it not work at all.

    Please can anybody help me out??

    Best regards.
     
    dieorfly, Sep 13, 2009 IP
  2. zeeeshan

    zeeeshan Peon

    Messages:
    102
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #2
    Nice Thankks
     
    zeeeshan, Sep 13, 2009 IP
  3. Stomme poes

    Stomme poes Peon

    Messages:
    3,195
    Likes Received:
    136
    Best Answers:
    0
    Trophy Points:
    0
    #3
    There are three places you should mention the charset. The meta tag is the least important.

    First, whatever you are typing your letters in must be saved as UTF-8. Meaning, if you are opening this HTML page in your text editor, that when you save your changes, your text editor is saving the document as UTF-8, and I am assuming you are writing your characters in a plain text editor and not some Windows product (such as Word).

    Second, the meta tag, which you have.

    Third, the server sends out a charset. If a browser comes to your page and see a meta tag and an HTTP header from the server and they conflict, the browser will ignore the meta tag (they often do that anyway). The server always wins.

    When you open your page in your browser, look at the HTTP headers. I'm not sure about other browsers but in Firefox you can either View>Page Info (older FF), or right-click on the page, find View Page Info... or better if you have some Live HTTP Headers type program. They will tell you what the server is sending the page out as. I'm going to bet my tush it's not UTF-8.

    If it is, then I'd wonder if your document is truly being saved as UTF-8.

    Lastly, a browser can choose to override the charset belonging to a page... most browsers are set to auto-detect, or UTF-8. This is most likely on a page where lots of people can see characters normally but one person can't, or one browser on one machine can't. I'm thinking this is not your problem.

    If it turns out your server is sending out the wrong charset, I dunno if you have your own server or shared hosting, but if they won't change it for you, you can change it with a .htaccess file (I'm assuming it's an Apache server here but there are usually similar things on other servers), though I forgot how to do this, and you can find it somewhere (not sure where!) on the askapache.com site. It's under .htaccess tricks/tips I think.

    Oh I just thought of another issue, though prolly not yours: if content is being saved into a database, there's another possibility of charset mixup. We have that problem at our company. I write in UTF-8, the data gets sent to a db which uses Latin1. So what comes out on the page? Latin-1, with some characters simply not appearing unless I had hard-coded them with decimal character entities (HTML entities like & # 235;). You would much rather fix the database then hard-code all your letters. : )

    Does any of this help?
     
    Stomme poes, Sep 13, 2009 IP