SitePoint Sponsor

User Tag List

Results 1 to 16 of 16

Hybrid View

  1. #1
    SitePoint Addict FizixRichard's Avatar
    Join Date
    May 2003
    Location
    UK
    Posts
    372
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)

    Post Korean Text in DB

    Hi,

    I'm currently working on a website which needs to store English and Korean text in a DB field.

    The problem is, the Korean typeface is not being stored correctly, it's being totally garbolled.

    I believe it has something to do with the DB fields properties, the entry form is a normal text entry field that inserts the data into a mysql DB.

    For reference:

    This: 회원가입

    is being turned into this: ȸ

    Does anyone know what is up with this?
    FIZIX - Full Service Digital Agency - Engaging websites, apps and games.
    Follow us @FIZIXAgency

  2. #2
    SitePoint Evangelist DMacedo's Avatar
    Join Date
    May 2004
    Location
    Braga, Portugal
    Posts
    596
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    The problem is in the table's default character set, you should use UTF8 to store korean (or any other multi-byte char language alike)
    ~ Daniel Macedo

  3. #3
    SitePoint Addict FizixRichard's Avatar
    Join Date
    May 2003
    Location
    UK
    Posts
    372
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    Yes, the DB field is UTF8, but it is still garbolled.

    I'll elaborate a little.

    I have a textarea in a form, where the user can entertext. This text is then stored in a MySQL DB (mediumtext). This can then be displayed on the site (dynamic content).

    This fields 'collation' in PHPMyAdmin is set to utf8_unicode_ci (also set it as utf8_general_ci and utf8_bin and it won't work).

    I too was under the impression that UTF8 was the character set we needed to use, so this is really confusing me and taking up way too much of my time on this project (as it's an important feature).
    FIZIX - Full Service Digital Agency - Engaging websites, apps and games.
    Follow us @FIZIXAgency

  4. #4
    SitePoint Evangelist DMacedo's Avatar
    Join Date
    May 2004
    Location
    Braga, Portugal
    Posts
    596
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Have you tried inserting the text in phpMyAdmin? Does that work?
    I am sure if you have the right character set and collation it has to work properly.

    If that doesn't work the issue can be in your connection to MySQL not using utf8 or something in those lines

    I'd have to check the PHP (?) handling of the string and debug that myself to properly understand what's wrong.
    ~ Daniel Macedo

  5. #5
    SitePoint Addict FizixRichard's Avatar
    Join Date
    May 2003
    Location
    UK
    Posts
    372
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    Hmm...

    OK, entering directly into PHPMyAdmin works, it's stored correctly in the DB however it is displayed on the site as '???? ?? ???' like that.

    So something somewhere isn't right, I'm really not sure if its my code (can it be?) or a setup issue with the server?
    FIZIX - Full Service Digital Agency - Engaging websites, apps and games.
    Follow us @FIZIXAgency

  6. #6
    SitePoint Evangelist DMacedo's Avatar
    Join Date
    May 2004
    Location
    Braga, Portugal
    Posts
    596
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    The only thing I can imagine is setting
    Code:
    SET character_set_client = utf8;
    SET character_set_connection = utf8;
    SET character_set_results = utf8;
    Upon your database connection and see if that solves the problem.
    ~ Daniel Macedo

  7. #7
    reads the ********* Crier silver trophybronze trophy longneck's Avatar
    Join Date
    Feb 2004
    Location
    Tampa, FL (US)
    Posts
    9,854
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    make sure you have the correct character set specified in the header of your HTML document. as a test, you can try changing the character set in the view menu of your browser.

  8. #8
    SitePoint Addict FizixRichard's Avatar
    Join Date
    May 2003
    Location
    UK
    Posts
    372
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)

    Smile

    Thats a very good point and fixed

    Thankyou to both of you
    FIZIX - Full Service Digital Agency - Engaging websites, apps and games.
    Follow us @FIZIXAgency


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
  •