Topic: Ajax Search Language Problem  (Read 6090 times)

Pages: [1]   Go Down

#1: 23-Nov-2007, 07:04 AM

cmku
Posts: 14

This is my test site: http://yhact.com/cms/

I am setting up a multi-lingual site in Eng and Chinese, have been having difficulties trying to get the Alax search from result to display Chinese characters properly.  Huh

Type "yhact" in the search form, you will see the Chinese characters doesn't show up correctly. The search form doesn't accept search for chinese characters either... whenever I type anything in chinese it returns as "no results found"...

Could anyone please tell me which file and code should I tweak to fix this bug, please help!

Thanks in advance  Wink
« Last Edit: 23-Nov-2007, 07:32 AM by cmku »

#2: 23-Nov-2007, 04:01 PM

Coding Team

coroico
Posts: 1,215

WWW
miao cmku

i look at your source code and it seems that you use the 1.6.1 version. You use UTF-8 as page character set but what is you mysql database character set ? is it also UTF-8 or an other character set.

Could you check that  your $database_connection_charset variable in the file /manager/includes/config.inc.php is correct. This variable should contains the connection charset of your mysql base (utf-8, latin1, ...) .

And look at http://modxcms.com/forums/index.php/topic,5357.301 to download the last 1.6.2 version

If not solved let me know
              AjaxSearch 1.8.4                                                          AnythingRating 1.0                                       ModxLinks repository                      
Download       Documentation                                                   Download            Documentation                                  
Demo site       Bugs & Features     Support                                Demo site            Support                                  CssSwitcher   Support     Download

#3: 23-Nov-2007, 11:13 PM

cmku
Posts: 14

 Smiley coroico,

Thank you so much!! It works now.

You have made my day whole lot brighter now  Grin

Cheers

#4: 28-Nov-2007, 08:37 AM

cmku
Posts: 14

hi coroico, i have another question regarding the AjaxSearch. I have another site hosted with Godaddy, on a shared server, and they have limited/disabled the 'php_mbstring.dll extension', and AjaxSearch  needs this turned on to work.

I am wondering if there is any other way to have the AjaxSearch work without turning the 'php_mbstring.dll extension' on?

Thanks again!!!

#5: 28-Nov-2007, 08:42 AM

Coding Team

coroico
Posts: 1,215

WWW
Hi cmku

Which character set do you use for your database ?
              AjaxSearch 1.8.4                                                          AnythingRating 1.0                                       ModxLinks repository                      
Download       Documentation                                                   Download            Documentation                                  
Demo site       Bugs & Features     Support                                Demo site            Support                                  CssSwitcher   Support     Download

#6: 28-Nov-2007, 08:55 AM

cmku
Posts: 14

hello, the character encoding i use is UTF-8 for all of my sites.

I have a few sites hosted with Godaddy shared server, and I have only realized that they turn the 'php_mbstring.dll' off~~~  the test site i am building is http://jaguartech.com.tw

thanks for your quick reply!

#7: 28-Nov-2007, 10:11 AM

Foundation

OpenGeek
MODx Co-Founder
Posts: 6,977

damn accurate caricatures...

WWW
That's a curious extension for them to leave out.  I see it as required in more and more projects as internationalization becomes more and more important...
Jason Coward
MODx Co-Founder
xPDO Founder
CTO @ Collabpad
work productively.
work intelligently.
work together.
Light is just a vibration of a note too. Everything is. You've got to keep that in mind.
  Frank Zappa

#8: 28-Nov-2007, 06:05 PM

Coding Team

coroico
Posts: 1,215

WWW
Hi cmku

If your database charset and your pages are all in UTF-8, normally you do not use the phb.mbstring extension, but ...

This extension is used to convert the searchstring from UTF-8 to the database charset. I will look at this trouble and  try to deliver a new version that takes into account of that. But i need some time to do that Smiley and collect some others requests.
              AjaxSearch 1.8.4                                                          AnythingRating 1.0                                       ModxLinks repository                      
Download       Documentation                                                   Download            Documentation                                  
Demo site       Bugs & Features     Support                                Demo site            Support                                  CssSwitcher   Support     Download

#9: 28-Nov-2007, 09:58 PM

cmku
Posts: 14

hi coroico,

I have set my database to UTF-8 (in my config.inc.php), and my template to UTF-8, but the search result still pop-up "php mbstring extension required".

This is what GoDaddy support said: "Dear Sir/Madam, Thank you for contacting online support. No, we only allow the php_mbstring.dll extension is only available with Dedicated and Virtual Dedicated server accounts. If you wish to have this feature you will need to upgrade to a virtual dedicated or dedicated server."

Thanks for your support, I really look forward to the new version, as AjaxSearch Rocks!

Have a good one

Joseph

#10: 1-Dec-2007, 12:02 PM

Coding Team

coroico
Posts: 1,215

WWW
Hi Cmku,

Please find enclosed a fix to solve the mbstring extension issue. Unzip the file and overwrite the AjaxSearch.php file of the snippet folder with this new version. Your Ajaxsearch snippet document doesn't need to be upgraded.

This a simple fix, not a new version. It works only when pages and database are in UTF-8.
This fix will be included in the new version (1.6.3) in preparation (but with no known delivery date  Grin )

Let me know if your issue is now corrected

* AjaxSearch-fix162b.zip (2.43 KB - downloaded 259 times.)
« Last Edit: 2-Dec-2007, 01:49 AM by coroico »
              AjaxSearch 1.8.4                                                          AnythingRating 1.0                                       ModxLinks repository                      
Download       Documentation                                                   Download            Documentation                                  
Demo site       Bugs & Features     Support                                Demo site            Support                                  CssSwitcher   Support     Download

#11: 1-Dec-2007, 10:15 PM

cmku
Posts: 14

Hi Coroico,

Thanks for the great support!! I have downloaded the file, and replaced my old file, but when I try to search, there is still error message "php_mbstring extension required". Perhaps I have missed something? please advise.  http://jaguartech.com.tw

Thanks again, I love this forum!  Cheesy

#12: 2-Dec-2007, 01:23 AM

Coding Team

coroico
Posts: 1,215

WWW
I think you get this message because:
Code:
if ($database_connection_charset != 'utf8' && !extension_loaded('mbstring')) {
  $result = "php_mbstring extension required";
}
In your previous message you get the following message error :

Fatal error:  Call to undefined function mb_convert_encoding() in ..\modx\assets\snippets\AjaxSearch\AjaxSearch.php on line 67

because you try to use a mbstring function:
Code:
    $searchString = mb_convert_encoding($_POST['search'],$pgEncoding , "UTF-8");
Could you check that  your $database_connection_charset variable in the file /manager/includes/config.inc.php is initialized with "utf8". You should find a line :
Code:
$database_connection_charset = 'utf8';
Be carefull the true connection charset is 'utf8' not 'UTF-8'. Mysql base use 'utf8' and html pages 'UTF-8'  Angry

If this variable is not well initialized; Do it and reload your page in your browser

If yes, do an another test : open the AjaxSearch.php file and change the line 66 by :
Code:
$result = "AjaxSearch: php_mbstring extension required";
I think it's not necessary but i would like to be sure that your message come from the test of the line 65

Let me know the results
« Last Edit: 2-Dec-2007, 01:49 AM by coroico »
              AjaxSearch 1.8.4                                                          AnythingRating 1.0                                       ModxLinks repository                      
Download       Documentation                                                   Download            Documentation                                  
Demo site       Bugs & Features     Support                                Demo site            Support                                  CssSwitcher   Support     Download

#13: 2-Dec-2007, 09:34 AM

cmku
Posts: 14

Coroico, yes, I checked my config.inc.php and changed from 'UTF-8' to 'UTF8', and then reloaded the page, then I found the Chinese characters in the navigation tabs turned into unreadable codes, I then tried to do a search, and still no luck...

Maybe I should buy a better server, as 'GoDaddy economic hosting' doesn't seem to work well for me.

Thanks for your kind support!!  Wink

#14: 2-Dec-2007, 09:58 AM

Coding Team

coroico
Posts: 1,215

WWW
Hi Cmku,

I look at your web site http://jaguartech.com.tw and i see that when i try to search any term (like ssssssss) I get the message : "AjaxSearch: php_mbstring extension required".

So you get the modified message that it confirms that the test
Code:
if ($database_connection_charset != 'utf8' && !extension_loaded('mbstring')) {
  $result = "AjaxSearch: php_mbstring extension required";
}
is true  Sad
if your php mbstring extension is not loaded, I deduce that $database_connection_charset is still different of 'utf8'

Be careful, the $database_connection_charset shoud be 'utf8' in lower case, not 'UTF-8' nor 'UTF8'
              AjaxSearch 1.8.4                                                          AnythingRating 1.0                                       ModxLinks repository                      
Download       Documentation                                                   Download            Documentation                                  
Demo site       Bugs & Features     Support                                Demo site            Support                                  CssSwitcher   Support     Download

#15: 2-Dec-2007, 10:56 AM

Testers

ganeshXL
Posts: 2,015

true is true

WWW
re: http://yhact.com/cms/
In FF, everything looks OK, apart from hover texts in chinese and part of the html-title. Search also works, incl. highlighting (engl. + chinese)
In Safari/Win, I see no chinese characters at all, just squares and gibberish. But OK, it's still officially in beta anyway...
IE7 behaves pretty much the same as FF.
(WinXP)

#16: 2-Dec-2007, 11:13 PM

cmku
Posts: 14

ganeshXL, yhact.com/cms is working fine, with Coroico's help Smiley, as it is not hosted with the economy GoDaddy account. The problem site is at jaguartech.com.tw, now I have used flexSearch for the moment, until I shift it to a better server. Thanks for checking, cheers!

#17: 16-Feb-2008, 09:02 PM

tirithen
Posts: 57

I'm trying to get ajaxSearch to display swedish characters åäö, the rest of my site displays åäö just fine but the search results displays in a bit different unreadeble characters depending on the combination of charsets I use.

My MODx version is 0.9.6.1p2 and ajaxSearch is 1.7.
MySQL server is set to  UTF-8 Unicode (utf8) and collation and charsets in databases set to latin1_swedish_ci
My MODx are $database_connection_charset = 'latin1';

Search results look like this:
Ã…rstider (should be Årstider)

Förhoppning (should be Förhoppning)

Jämtländsk (should be Jämtländsk)

Where should I change which charset to get the same result as in my documents?
Pages: [1]   Go Up
0 Members and 1 Guest are viewing this topic.