473,385 Members | 1,829 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

Query using unicode

Hi,

I have set up a MySQL database (MySQL 4.1) which is encoded in UTF-8
with the utf8_general_ci collation. Inserted into the database is some
Japanese dictionary information.

Now I'd like to querie my database from within a PHP5 script. I have a
webform where the user inputs the Japanese data that needs to be queried
(webpage uses UTF-8 encoding). In my script I tell the database that I'm
sending unicode data: $db->query("SET NAMES 'utf8'");

Then I construct a query that looks like:

SELECT * FROM EDICT WHERE KANA=$term

The variable term contains the user inputted utf-8 data. However, this
query does not work. It gives zero results (and I've made sure that the
requested data is actually in the database).

The data in $term seems correct (it displays correctly when I echo the
variable).

What am I missing here?
Jul 17 '05 #1
4 1834
i still new also in the field but just want to throw an idea.. is we
need to do some header control ...
to indicate that our form is japanese charachter form set ??

any one can help??

Jul 17 '05 #2
badz wrote:
i still new also in the field but just want to throw an idea.. is we
need to do some header control ...
to indicate that our form is japanese charachter form set ??

any one can help??


Actually the form is working ok (I have the following header in my html:

<meta http-equiv="Content-Type" content="text/html;charset=UTF-8" />

You can check it at www.belgium-anime.com/vocablist/search.php5

Try for example to look for the word $B$O$J$S(B (hanabi) (this message is
encoded in ISO-2022-JP). This word is in my vocabulary list. I can
retrieve the input from the form correctly (As you can see when
submitting the form. The inputted data gets displayed correctly, the
query is also displayed correctly).

For some reason the query gives no result. I'm sure the data in my
database is correct, because I use it for another webpage
(www.belgium-anime.com./vocablist/index.php5).

Do I perhaps need a special comparison operator to compare non-standard
text?

Any help is appreciated!
Jul 17 '05 #3
Kris wrote:
badz wrote:
i still new also in the field but just want to throw an idea.. is we
need to do some header control ...
to indicate that our form is japanese charachter form set ??

any one can help??

Actually the form is working ok (I have the following header in my html:

<meta http-equiv="Content-Type" content="text/html;charset=UTF-8" />

You can check it at www.belgium-anime.com/vocablist/search.php5

Try for example to look for the word $B$O$J$S(B (hanabi) (this message is
encoded in ISO-2022-JP). This word is in my vocabulary list. I can
retrieve the input from the form correctly (As you can see when
submitting the form. The inputted data gets displayed correctly, the
query is also displayed correctly).

For some reason the query gives no result. I'm sure the data in my
database is correct, because I use it for another webpage
(www.belgium-anime.com./vocablist/index.php5).

Do I perhaps need a special comparison operator to compare non-standard
text?

Any help is appreciated!


Kris,

I can't help you myself with this problem, but I would advise you to ask
the question on the MySQL general mailing list. The MySQL developers
hang out on that list.

See <http://lists.mysql.com/mysql>

HTH,
JP

--
Sorry, <de*****@cauce.org> is a spam trap.
Real e-mail address unavailable. 5000+ spams per month.
Jul 17 '05 #4
Kris wrote:
Then I construct a query that looks like:

SELECT * FROM EDICT WHERE KANA=$term


Don't forget to put quotes on the string!

Hint: try searching for "KANA LIMIT 5"

-- brion vibber (brion @ pobox.com)
Jul 17 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: Marco Iannaccone | last post by:
I'd like to start using Unicod (especially UTF-8) in my C programs, and would like some infos on how to start. Can you tell me some documents (possibily online) explaining Unidoce and UTF-8, and...
4
by: Bob Sillett | last post by:
This is one of those issues that doesn't clearly fit into a single category as it's both a C# and a database (mySql) issue. I want to INSERT and SELECT text in UTF8 from a C# application to...
0
by: Yovav | last post by:
I have an MS SQL account somewhere on the net and I had problems using DTS for import/export data as OBJECTs (which including things like IDENTITY fields and Primary key...) Though SP3 is...
9
by: Mark | last post by:
I've run a few simple tests looking at how query string encoding/decoding gets handled in asp.net, and it seems like the situation is even messier than it was in asp... Can't say I think much of the...
20
by: SMG | last post by:
Hi All, I have created an application which is working fine and is in about to launch, now suddenly my mgmt says there are chances that Scrip ID( a particular id and not prim key) may have special...
2
by: aurora | last post by:
I have some unicode string with some characters encode using python notation like '\n' for LF. I need to convert that to the actual LF character. There is a 'unicode_escape' codec that seems to...
5
by: kaustubh.deo | last post by:
Hi, can somebody tell the importance of Hex values specified in code pages. For ex say for code page 850 http://en.wikipedia.org/wiki/CP_850 If u see this code page, for extended char we have...
3
by: pratik.best | last post by:
Hi, I just seen the web site of the unicode committee and was amazed to see the site showing document in Hindi without using any such fonts like "Kruti Dev" or "Dev Lys". "Webdunia.com" is also...
8
by: Rui Maciel | last post by:
I've just started learning how to use the wchar_t data type as the basis for Unicode strings and unfortunately I'm having quite a bit of problems, both in the C front and the Unicode front. In...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.