Korean Website - Question/Help
Results 1 to 9 of 9

Thread: Korean Website - Question/Help

  1. #1
    Senior Member
    Join Date
    Nov 2005
    Posts
    318

    Korean Website - Question/Help

    Hi all

    I am replicating a UK based website to be traslated into Korean and it will also be hosted in Korea.

    I have a mySQL database setup with UTF-8 encoding and I have copied my korean content into it.

    For my site code, I have looked around for hints and tips and eventually settled on the following meta data at the top of my site:

    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" lang="ko">
    <meta http-equiv="content-language" content="ko">
    <meta http-equiv="content-type" content="text/html; charset=euc-kr">
    Now when I run my homepage and display my menu items (which are translated into Korean and stored in my database) the browser displays question mark characters instead of the Korean content.

    Does anyone have any ideas on how I can get the Korean content to display?

    Many thanks for reading.

    Kris

  2. #2
    Senior Member
    Join Date
    Nov 2005
    Posts
    318
    Just to add, I can hard code the Korean content directly into the body and it displays fine in the browser, its only when I pull the data from the database does the question mark characters appear!

    Any advice would be greatly appreciated.

  3. #3
    Senior Member Derokorian's Avatar
    Join Date
    Apr 2011
    Location
    Denver
    Posts
    1,784
    What's the charset / collation of the database tables and columns?
    Sadly, nobody codes for anyone on this forum. People taste your dishes and tell you what is missing, but they don't cook for you. ~anoopmail
    I'd rather be a comma, then a full stop.
    User Authentication in PHP with MySQLi - Don't forget to mark threads resolved - MySQL(i) warning

  4. #4
    Pna lbh ernq guvf¿
    Join Date
    Jul 2004
    Location
    Kansas City area
    Posts
    19,429
    If your data is stored as UTF-8, why are you outputting the incorrect character set in your HTML header? Speaking of that header... where's the <head> element? Are you sure your HTML is even valid markup?

    Did you execute a SET NAMES command when connecting to MySQL? (See this page in the MySQL manual for info on what that command does.)

  5. #5
    Senior Member
    Join Date
    Nov 2005
    Posts
    318
    The MySQL database is currently set to UTF-8.

    My first question would be is this OK to continue or should it be changed to something else?

    Secondly, if UTF-8 is OK, would the META data be setup as:

    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" lang="ko">
    <head>
    <meta http-equiv="content-language" content="ko">
    <meta http-equiv="content-type" content="text/html; charset=utf-8">
    I am kind of shooting in the dark here to be honest.

    bradgrafelman - I used "SET NAMES utf8;" and the questions marks changed to other symbols but none of which match the content stored in my database.

    I am sure there is a simple solution and its just getting th ecombination of database and meta tags correct maybe?

    If someone could correct the META tag data above and maybe confirm what the encoding of the database should be I will take it from their!

    Thanks for helping and reading.

  6. #6
    Senior Member Derokorian's Avatar
    Join Date
    Apr 2011
    Location
    Denver
    Posts
    1,784
    Here's the meta tag I use:
    HTML Code:
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
    You might also consider issuing a charset header before any output like this:
    PHP Code:
    header('Content-Type: text/html; charset=UTF-8'); 
    Sadly, nobody codes for anyone on this forum. People taste your dishes and tell you what is missing, but they don't cook for you. ~anoopmail
    I'd rather be a comma, then a full stop.
    User Authentication in PHP with MySQLi - Don't forget to mark threads resolved - MySQL(i) warning

  7. #7
    Senior Member
    Join Date
    Aug 2008
    Location
    London, UK
    Posts
    753
    kbc1, what about what Derokorian mentioned, "What's the charset / collation of the database tables and columns?"
    Ashley Sheridan
    www.ashleysheridan.co.uk

  8. #8
    Senior Member
    Join Date
    Nov 2005
    Posts
    318
    The database is set as UTF-8.

    I have overnight managed to get the webpage pulling out the correct Korean content using the following:

    Code:
    <html xmlns="http://www.w3.org/1999/xhtml" lang="ko">
    <head>
    <meta http-equiv="content-language" content="ko">
    <meta http-equiv="content-type" content="text/html; charset=utf-8">
    I also used this:

    PHP Code:
    $qry "SET character_set_results=utf8";
    $res mysql_query($qry); 
    However, I am now at the admin system end which allows the user to store the data and when I save the Korean characters they save as a random collection of symbols and NOT the Korean characters.

    Is there any specific function I need to use to get the Korean data to store into the MyQL database correctly?

    For information, I can copy and paste the Korean content into the database directly and it saves fine.

    Many Thanks

  9. #9
    Pna lbh ernq guvf¿
    Join Date
    Jul 2004
    Location
    Kansas City area
    Posts
    19,429
    In the admin system, do you have the character set defined on all HTML pages (such as with a <meta> tag, a Content-Type header, or both)? Likewise, do you issue a 'SET NAMES' SQL command before anything else?

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

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