SitePoint Sponsor

User Tag List

Results 1 to 7 of 7
  1. #1
    SitePoint Addict
    Join Date
    Jan 2007
    Posts
    296
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Website Includes with Foreign language

    I am having trouble having translated a website into Swedish getting it to format correctly.

    The majority of the site is fine, itís just when I have includes file in the pages anything in the includes file that uses a special character doesnít work and I get the diamond with a question mark and just a white empty box on ie.

    How can I fix this issue without having to lose the includes files? Because the same text in the actual page will work fine so it has to be an issue with the includes, none of the includes have a doctype but all the actual pages use the following doctype

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

  2. #2
    Design Your Site Team bronze trophy Erik J's Avatar
    Join Date
    May 2007
    Location
    Countryside, Sweden
    Posts
    3,407
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    You also need to give the character set the document is saved in (check the save settings in your editor). I think you could try the iso-8859-1, or -15 for adding the Euro sign, if you are not sure what you have.
    Code:
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
    <html lang="sv">
    <head>
    	<meta http-equiv="content-type" content="text/html; charset=ISO-8859-1">
    	<title>Untitled Document</title>
    Then I recommend the read of this thread about html/xhtml and doctypes.
    Happy ADD/ADHD with Asperger's

  3. #3
    Robert Wellock silver trophybronze trophy xhtmlcoder's Avatar
    Join Date
    Apr 2002
    Location
    A Maze of Twisty Little Passages
    Posts
    6,316
    Mentioned
    60 Post(s)
    Tagged
    0 Thread(s)
    You'll have a mismatch of encoding and it is likely the includes are set to a default of ISO-8859-1. Do you have a live page at the moment.

    You'll be probably seeing 'replacement character' � (often a black diamond with a white question mark) a symbol found in the Unicode standard at codepoint U+FFFD in the Specials table.

  4. #4
    SitePoint Wizard donboe's Avatar
    Join Date
    Jun 2010
    Location
    Netherlands
    Posts
    2,114
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I don't know what include files you use and if that includes data from a database. But I normally have to set a utf-8 connection string.

  5. #5
    SitePoint Addict
    Join Date
    Jan 2007
    Posts
    296
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    The includes are just bog standard php includes with html in there. The test site is available at the following address

    www. benzlers.com /se-test/ industrier.php

    the includes is on the right hand side and is the black diamond error message.

  6. #6
    Design Your Site Team bronze trophy Erik J's Avatar
    Join Date
    May 2007
    Location
    Countryside, Sweden
    Posts
    3,407
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    You now give two charsets! Only one is permitted.
    Code:
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    -
    -
    -<title>Industrier</title>
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
    The documents character set statement must correspond with that the document is saved with (more clearly; edited in). Probably your editor is saving in ISO-8859-1, but then the first meta tag says it should be read as UTF-8.

    Try remove the first meta tag and move the second up in place. I.e. remove it from the include file.
    Code:
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
    -
    -
    <title>Industrier</title>
    -
    Or you can edit and save in utf-8 if you set your editor accordingly. You can open, then change editor setting for the includes, and re-save them as utf-8. Then keep the utf-8 meta tag as in original document.
    Happy ADD/ADHD with Asperger's

  7. #7
    SitePoint Addict
    Join Date
    Jan 2007
    Posts
    296
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Erik J, thank you that solution worked perfectly.


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
  •