1. Computer problem? Tech Support Guy is completely free -- paid for by advertisers and donations. Click here to join today! If you're new to Tech Support Guy, we highly recommend that you visit our Guide for New Members.

PHP/MySQL does unicode? Query not working...

Discussion in 'Software Development' started by Puritan, Oct 8, 2003.

Thread Status:
Not open for further replies.
  1. Puritan

    Puritan Thread Starter

    Feb 14, 2001
    Hi, I'm converting pages from ASP and (I think) MSSQL to PHP and MySQL... the database stores a lot of Korean data that worked in the original, but not in the new version. For example, there was a query:

    SELECT Name, Duty from ProfileMember where UNICODE(Left(Name, 1)) >= " & indexKeyword(intKeyword) &" and UNICODE(Left(Name, 1)) < " & indexKeyword(intKeyword + 1) & " ORDER BY Name"

    indexKeyword is a predefined array of Unicode values that determines what names we show on each page.

    Anyway, there is no UNICODE() function in MySQL, so far as I know, so I'm wondering how to replicate this functionality. I tried using ORD(Name), which is supposed to return the first character, even if it's stored in multi-byte format, but it doesn't work the way it should. (From trial and error, all of the names stored have Ords under 200 or so, whereas the original Unicode encodings are 44032, 45208, 45796, etc.) Not only that, but if I get rid of the Ord requirements altogether and just tell them to bring back all the records sorted by Name, the results do not get properly sorted. (They are sorted to some fashion, i.e. if I tell it to reverse the sorting, they come back in reverse order, but it's not Korean alphabetical, i.e. Unicode-sorted, that's for sure.)

    Anyone know how to make this work? Thanks.
As Seen On
As Seen On...

Welcome to Tech Support Guy!

Are you looking for the solution to your computer problem? Join our site today to ask your question. This site is completely free -- paid for by advertisers and donations.

If you're not already familiar with forums, watch our Welcome Guide to get started.

Join over 733,556 other people just like you!

Thread Status:
Not open for further replies.

Short URL to this thread: https://techguy.org/170352

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice