Help With Characters Not Displaying

Discussion in 'PHP' started by projectWORD, Nov 11, 2008.

  1. #1
    Hi,

    I am creating a website in Turkish which was translating fine.

    I was editing each page and replacing English text with the turkish equivalent but when it came to extracting data from a database and then displaying it certain letters would not show, being replaced by a ?.

    The data displays fine in the database but not when displayed on page.

    Any ideas?
     
    projectWORD, Nov 11, 2008 IP
  2. iDemonix

    iDemonix Peon

    Messages:
    37
    Likes Received:
    3
    Best Answers:
    0
    Trophy Points:
    0
    #2
    I post this with uncertainty, are you sure the font you're reading the site in supports Turkish characters. Not that I know anything about the language.
     
    iDemonix, Nov 11, 2008 IP
  3. bpasc95

    bpasc95 Active Member

    Messages:
    196
    Likes Received:
    3
    Best Answers:
    0
    Trophy Points:
    70
    #3
    You'll need to take a look at how the data is stored. More specifically, the character set of the data going in as well as the data going out.
     
    bpasc95, Nov 11, 2008 IP
  4. deathshadow

    deathshadow Acclaimed Member

    Messages:
    9,732
    Likes Received:
    1,999
    Best Answers:
    253
    Trophy Points:
    515
    #4
    This would be my take as well. I would suspect the font used on the site doesn't have a turkish 'branch' installed.

    Though it could also be your character encoding, be it either what your server is declaring, what you are not declaring in your php via the header command, or that your database is storing in a different format than your document encoding.

    I would make sure your php is sending a UTF-8 header, make sure the document itself is set to UTF-8, and check that the font being used on the page is in fact capable of even displaying turkish characters. On windows machines you can only really rely on Arial, Courier New and Times New Roman providing alternate language support, and on other operating systems you are likely SoL unless the user has the language installed and is aware of the alternative language shortcomings (and no, including the 1 gig of language packs for OS X does NOT actually add font support!)
     
    deathshadow, Nov 11, 2008 IP
  5. projectWORD

    projectWORD Active Member

    Messages:
    287
    Likes Received:
    2
    Best Answers:
    1
    Trophy Points:
    63
    #5
    If I enter the data into the website statically all turkish characters are displayed.

    Dreamweaver converts each special character to the relvant code &co123; etc.

    When I take this from a database that conversion doesnt happen.

    It cannot be the font as it is possible to display the characters isnt it?

    What PHP header should I use, is this required as well as the html header.
     
    projectWORD, Nov 13, 2008 IP
  6. projectWORD

    projectWORD Active Member

    Messages:
    287
    Likes Received:
    2
    Best Answers:
    1
    Trophy Points:
    63
    #6
    HI

    $cattest = "Yönetim Danışmanlığı";

    print $cattest;

    This is some code that I have entered into notepad. I have also added the following headers.

    header('Content-Type: text/plain; charset=ISO-8859-9'); - At top of php code

    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-9" /> - In head of html

    But....

    The output of this is Yönetim Danışmanlığı

    Where does the problem lie?
     
    projectWORD, Nov 13, 2008 IP
  7. deathshadow

    deathshadow Acclaimed Member

    Messages:
    9,732
    Likes Received:
    1,999
    Best Answers:
    253
    Trophy Points:
    515
    #7
    Well, notepad saves as Windows-1252... web servers default to ISO-8859-1, and you want either UTF-8 or ISO-8859-9... Therin lies your problem.

    I would grab an editor with ISO-8859-9 or UTF-8 support, like Crimson Editor or Notepad++, and then make sure you have the correct encoding. As to dreamweaver do yourself a favor and pitch that rubbish in the trash.
     
    deathshadow, Nov 13, 2008 IP
  8. projectWORD

    projectWORD Active Member

    Messages:
    287
    Likes Received:
    2
    Best Answers:
    1
    Trophy Points:
    63
    #8
    Hi, Thanks for that but I do use notepad++ with the chracter coding of UTF8.

    I just said notepad for short.

    Any other clues of whats going on?
     
    projectWORD, Nov 13, 2008 IP