SitePoint Sponsor

User Tag List

Results 1 to 7 of 7
  1. #1
    SitePoint Addict khuramyz's Avatar
    Join Date
    Oct 2005
    Location
    Manchester, UK
    Posts
    296
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Danish Language :(

    Hello,

    I am making a site in the danish language.
    So when I change the text in the html, it gets out like something else

    When I write the danish for Help which is Hjælp, its coming out as Hj�lp. Its due to the special characters in the danish language that it is happening.

    I tried to change the <html> tag to <html lang="DA"> but even that dint help.
    Anyone call me the simple settings by which i can write the danish characters and they dont come out as question marks.

    You might argue that we could put the character codes for these in the code but this is not easy for php code as I might have to do that a on a big scale.

    Thanks.
    Last edited by khuramyz; Nov 9, 2007 at 08:22. Reason: missed some comments

  2. #2
    SitePoint Guru Ruben K.'s Avatar
    Join Date
    Jun 2005
    Location
    Alkmaar, The Netherlands
    Posts
    693
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    You might want to change the charset into one that supports danish characters

  3. #3
    SitePoint Zealot
    Join Date
    Jun 2007
    Posts
    150
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    What encoding is being spat out with the HTTP headers?

    Might want to alter it or add a meta tag for the encoding you save the file in.

  4. #4
    SitePoint Addict khuramyz's Avatar
    Join Date
    Oct 2005
    Location
    Manchester, UK
    Posts
    296
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Where can I manage the encoding ?

    Also what meta tag are we talking about ?

    Thanks

  5. #5
    SitePoint Wizard silver trophy kyberfabrikken's Avatar
    Join Date
    Jun 2004
    Location
    Copenhagen, Denmark
    Posts
    6,157
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Meta tags are irrelevant, if the page is served from a web server.

    Your web server is sending a HTTP header, which tells the browser, which encoding the document is in. Most likely, it say either UTF-8 or ISO-8859-1. Both encodings are suitable for Danish characters (And western European in general).
    If your web server says the document is encoded as UTF-8, but you do in fact send ISO-8859-1 encoded data, the browser will interpret the text wrongly. Since the two encodings are interchangeable on the US-ASCII range (codepoint 0-127), you will only see the problems with special characters (above the 127-range). These include the Danish national characters.

    Most likely, your page is in ISO-8859-1, but you're advertising it as UTF-8. You can find out if this is the case, by opening the menu View > Charcter Encoding (In Firefox). The encoding, which the browser is using, will be highlighted.
    To change it, you need to send the correct header, specifying which charset you're using. To specify ISO-8859-1, you would use the following:
    PHP Code:
    header("Content-Type: text/html; charset=ISO-8859-1"); 

  6. #6
    SitePoint Addict khuramyz's Avatar
    Join Date
    Oct 2005
    Location
    Manchester, UK
    Posts
    296
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hello,

    This is my website. www.shoppinguiden.dk
    Can you tell me what encoding is the page using and what it should actually be doing.

    thanks

  7. #7
    SitePoint Wizard silver trophy kyberfabrikken's Avatar
    Join Date
    Jun 2004
    Location
    Copenhagen, Denmark
    Posts
    6,157
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Since you aren't sending any HTTP-header, specifying the charset, the meta-tag is used instead. This page is interpreted as UTF-8. That means that any strings, you output should be in UTF-8. Looking at the page, that seems to be the case.
    Where do you get the malformed string from? Does it come from the database, or from a PHP string constant?

    Off Topic:


    Oh, and that's "Tilmeld dig nyhedsbrev", not "Meld dig i mailing liste"


Bookmarks

Posting Permissions

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