[TYPO3-english] indexed_search in a Latin1/UTF-8 Environment
Michael Michalowski
m.michalowski at hottgenroth.de
Mon Oct 12 17:35:43 CEST 2009
hi!
I have a typo3 project where the database is latin1 (ISO-8859-1) encoded and the frontend output is printed with meta charset utf-8. Everything is running fine except indexed_search (which splits search words at german umlauts an garbles them).
So I tried to convert the system to real UTF-8 but failed. At first I tried to fix it with the extension convert2utf8 and backend charset settings to utf-8 (which resulted in rubbish at several places), then I tried to convert the database into utf-8 (which seemed to be fine, but failed for templavoilá data structures and serialized flex form contents).
Because the project is nearly online I decided that the latin1 backend is ok and looked for the problem with indexed_search. I found out that the search terms are delivered as latin1 to the plugin which expects utf-8 contents. So I changed one line in class.tx_indexedsearch.php (at line 435):
$inSW = substr($this->piVars['sword'],0,200);
to
$inSW = substr(iconv($GLOBALS['TSFE']->defaultCharSet, 'UTF-8', $this->piVars['sword']),0,200);
So, my question is the following:
Is there any cleaner way to get index_search running in a latin1/utf-8 scenario? Why are the search terms passed as latin1 to the extension (search form page is utf-8!)?
My goal is to find a solution which will survive my next typo update... ;)
Thanks for your thoughts.
best regards,
Michael
More information about the TYPO3-english
mailing list