1.4.0:search function does not work with chinese characters

In this board you can talk about general questions about phpMyFAQ

Moderator: Thorsten

Post Reply
ipig
Posts: 22
Joined: Tue Jun 22, 2004 4:35 pm

1.4.0:search function does not work with chinese characters

Post by ipig »

Hello Thorsten

it seems that the search function can not find any matching records is the keywords input are in chinese characters.

could you please check this out?
best regards.
netz
Thorsten
Posts: 15739
Joined: Tue Sep 25, 2001 11:14 am
Location: #phpmyfaq
Contact:

Post by Thorsten »

Hi,

yes, I know this issue. You'll have to use MySQL 4.1.x to use with Chinese characters. Sorry! :-(

bye
Thorsten
phpMyFAQ Maintainer and Lead Developer
amazon.de Wishlist
Thorsten
Posts: 15739
Joined: Tue Sep 25, 2001 11:14 am
Location: #phpmyfaq
Contact:

Post by Thorsten »

Hi,

maybe there is a chance for a hack. Which version of phpMyFAQ do you use?

bye
Thorsten
phpMyFAQ Maintainer and Lead Developer
amazon.de Wishlist
ipig
Posts: 22
Joined: Tue Jun 22, 2004 4:35 pm

Post by ipig »

just checked , it's PHP 4.3

PLS.....HELP ME OUT... :(
Thorsten
Posts: 15739
Joined: Tue Sep 25, 2001 11:14 am
Location: #phpmyfaq
Contact:

Post by Thorsten »

Hi,

and which version of phpMyFAQ do you use? :)

bye
Thorsten
phpMyFAQ Maintainer and Lead Developer
amazon.de Wishlist
ipig
Posts: 22
Joined: Tue Jun 22, 2004 4:35 pm

Post by ipig »

SORRY, wrong input

my phpmyfaq is : powered by phpMyFAQ 1.4.0 RC1

php version is 4.3
Thorsten
Posts: 15739
Joined: Tue Sep 25, 2001 11:14 am
Location: #phpmyfaq
Contact:

Post by Thorsten »

Hi,

okay, the last info I need: MySQL Server and MySQL client version.

bye
Thorsten
phpMyFAQ Maintainer and Lead Developer
amazon.de Wishlist
ipig
Posts: 22
Joined: Tue Jun 22, 2004 4:35 pm

Post by ipig »

Hi, master,

MySQL 3.23.55
but i dont know it's server or client version, i got this information from:
Welcome to phpMyAdmin 2.2.2
MySQL 3.23.55 running on localhost as

best regards.



Thorsten wrote:Hi,

okay, the last info I need: MySQL Server and MySQL client version.

bye
Thorsten
Thorsten
Posts: 15739
Joined: Tue Sep 25, 2001 11:14 am
Location: #phpmyfaq
Contact:

Post by Thorsten »

Hi,

is it possible to upgrade your database to MySQL 4.1.2? This version supports unicode characters.

bye
Thorsten
phpMyFAQ Maintainer and Lead Developer
amazon.de Wishlist
ipig
Posts: 22
Joined: Tue Jun 22, 2004 4:35 pm

Post by ipig »

hi, thorsten,

i am afraid that 's hard.

I noticed that the old version of phpmyfaq works with chinese chars, so
I want to modify the search function by myself, could you please give me some advise how to do that?

i really dont want to give up phpmyfaq because of lower version of mysql.


i found out there seems two solution to this:
A: add binary when declare the key word variable:
key_word_to_search char(10)binary

B: USING Locate function of mysql:

SELECT * FROM table WHERE locate(field,'chinese_string') > 0;
Last edited by ipig on Fri Jul 02, 2004 9:51 am, edited 2 times in total.
Thorsten
Posts: 15739
Joined: Tue Sep 25, 2001 11:14 am
Location: #phpmyfaq
Contact:

Post by Thorsten »

Hi,

hm, which version of phpMyFAQ worked with chinese characters?

bye
Thorsten
phpMyFAQ Maintainer and Lead Developer
amazon.de Wishlist
ipig
Posts: 22
Joined: Tue Jun 22, 2004 4:35 pm

Post by ipig »

hi, Thorsten,

as far as i know, from php 3.x it can work with chinese chars.

i try to google , then found out the following solutions, and i decide to modify the search function , which solution do you think is better?

A: add binary when declare the key word variable:
key_word_to_search char(10)binary

B: USING Locate function of mysql:

SELECT * FROM table WHERE locate(field,'chinese_string') > 0;

best regards.
Thorsten
Posts: 15739
Joined: Tue Sep 25, 2001 11:14 am
Location: #phpmyfaq
Contact:

Post by Thorsten »

Hi,

the second version should work. What you can test is changing the line 693 in inc/functions.php from

Code: Select all

$begriff = safeSQL(trim($begriff));
to

Code: Select all

$begriff = trim($begriff);
bye
Thorsten
phpMyFAQ Maintainer and Lead Developer
amazon.de Wishlist
phpmyfaqfans
Posts: 3
Joined: Thu Jul 01, 2004 5:06 pm

Post by phpmyfaqfans »

Hi,Thorsten,

finally it works :-)

i changed the $query string from
$query = "SELECT id, lang, rubrik, thema, content FROM ".SQLPREFIX."faqdata WHERE MATCH (thema,content,keywords) AGAINST ('".$begriff."') AND active = 'yes'";

to
$query = "SELECT id, lang, rubrik, thema, content FROM ".SQLPREFIX."faqdata WHERE ( locate('".$begriff."',thema) or locate('".$begriff."',content) or LOCATE('".$begriff."',keywords) ) AND active = 'yes'";

in the searchEngine funcion of file functions.php under inc folder.

it's great!

thanks for your help.
have a nice day.
Post Reply