Problem with search with Japanese

Please report bugs here!

Moderator: Thorsten

Post Reply
pocomoco
Posts: 2
Joined: Fri Jan 01, 2010 7:52 pm

Problem with search with Japanese

Post by pocomoco »

Hi,
I installed the 2.5.6 version of phpmyfaq on a linux server, with japanese language.
Everything is OK, unless the search item.

No result retrurned.

I've received satisfactory result when I edited inc/functions.php

Code: Select all

--- ./inc/functions.php.org  2009-12-23 02:36:36.000000000 +0900
+++ ./inc/functions.php  2010-01-01 23:03:30.000000000 +0900

@@ -934,7 +934,7 @@
     $db          = PMF_Db::getInstance();
     $faqconfig   = PMF_Configuration::getInstance();
 
-    $result = getSearchData(htmlentities($searchterm), true, $cat, $allLanguages);
+    $result = getSearchData($searchterm, true, $cat, $allLanguages);
     $num    = $db->num_rows($result);
}

This problem reson why htmlentities() didn't set character set, I think.

Is this way right?

Thanks for your help,

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

Re: Problem with search with Japanese

Post by Thorsten »

Hi,

this breaks other languages...

Please try this:

Code: Select all

diff --git a/phpmyfaq/inc/functions.php b/phpmyfaq/inc/functions.php
index 3009ede..3348f58 100644
--- a/phpmyfaq/inc/functions.php
+++ b/phpmyfaq/inc/functions.php
@@ -934,7 +934,7 @@ function searchEngine($searchterm, $cat = '%', $allLanguages = true, $hasMore =
     $db          = PMF_Db::getInstance();
     $faqconfig   = PMF_Configuration::getInstance();
 
-    $result = getSearchData(htmlentities($searchterm), true, $cat, $allLanguages);
+    $result = getSearchData(htmlentities($searchterm, ENT_COMPAT, $PMF_LANG['metaCharset']), true, $cat, $allLanguages);
     $num    = $db->num_rows($result);
 
     if (0 == $num) {
bye
Thorsten
phpMyFAQ Maintainer and Lead Developer
amazon.de Wishlist
pocomoco
Posts: 2
Joined: Fri Jan 01, 2010 7:52 pm

Re: Problem with search with Japanese

Post by pocomoco »

I received good result.
Thank you for your accurately!

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

Re: Problem with search with Japanese

Post by Thorsten »

Hi,

thanks for the feedback! :-)

I'll commit it in my repo.

bye
Thorsten
phpMyFAQ Maintainer and Lead Developer
amazon.de Wishlist
Post Reply