Page 1 of 1

Search Moudule 1.1: Trailing Whitespace Search Error

Posted: Wed Jan 31, 2007 2:12 am
by jimbabwe
Not sure if this has been encountered already, but if I use the built-in search module 1.1 to search terms from news articles and enter a single word with trailing whitespace, the results page has problems.

I'm working on a Russian site. If I eliminate the trailing whitespace, the results appear:

Search Results For "ООН"

    * News - Центральноазиатские страны будут восстанавливать деградированные земли (100%)

If I search for the same term with trailing whitespace, there's a problem with the title of the new article and the results appear:

Search Results For "ООН "

    * News - �������������������������������������� ������������ ���������� ������������������������������ ������������������������������ ���������� (100%)

The characters showing as little squares above actually appear as black diamonds with a question mark in the middle.

I've switched browser encoding options to try all cyrillic encodings to see whether this is the result of a charset, but no luck.

Any ideas?

Thanks in Advance.

Re: Search Moudule 1.1: Trailing Whitespace Search Error: A Solution...

Posted: Fri Feb 02, 2007 12:29 am
by jimbabwe
I added a line to the 'action.dosearch.php' in the Search directory that seems to have fixed my problem:

Line 7 of action.dosearch.php reads:

                    $params['searchinput'] = htmlspecialchars($params['searchinput']);

I added the following just below line 7:

                    $params['searchinput'] = chop($params['searchinput']);

Seems to work.  I tested by adding 1, 2, 3, etc. whitespaces with no more errors in the search results.