[TYPO3-dev] MySQL, search and utf8

ries van Twisk typo3 at rvt.dds.nl
Tue Oct 9 00:12:09 CEST 2007


On Oct 8, 2007, at 5:01 PM, Steffen Kamper wrote:

>
> "ries van Twisk" <typo3 at rvt.dds.nl> schrieb im Newsbeitrag
> news:mailman.1001.1191868206.20721.typo3-dev at lists.netfielders.de...
>
> On Oct 8, 2007, at 1:05 PM, Martin Kutschker wrote:
>
>> Steffen Kamper schrieb:
>>> Hi,
>>>
>>> i have a non-TYPO3-question.
>>>
>>> I perform a search in MySQL and for example look for the word   
>>> "schön".
>>> So my
>>> query looks like:
>>>
>>> Select .... where ... and (body like "schön%" or body like "% 
>>> schön %" or
>>> body
>>> like "%schön" or body = "schön")
>>>
>>> looking to the results i see that MySQL shows up result with the  
>>> word
>>> "schon" which is different. Thoug it is utf8, the letter ö is   
>>> saved in
>>> utf8
>>> as 2-Byte, so why gives MySQL me the result with o?
>>
>> Mysql knows three character sets: the one the clients sends  
>> (queries),
>> the one the server uses (data storage) and the one the the server   
>> sends
>> (query results).
>>
>> Seems like the last settings is for some reason not UTF8. See the   
>> Mysql
>> docs on how to set (and check) those settings.
>
> It has something todo what collation is used internally for sorting
> and filtering...
> In this case MySQL did a good thing and did stick to standards... see
> below..
>
>>
>> Masi
>
>
> Hey steffen,
>
> this document will explain it to you..
> http://dev.mysql.com/doc/refman/5.0/en/charset-collation-effect.html
>
> and this one how to solve your specific problem..
>
> http://dev.mysql.com/doc/refman/5.0/en/charset-collate.html
>
> Ries
>
> indeed it seems to work proper with
>
> SELECT ... FROM tx_drwiki_pages COLLATE latin1_german2_ci ...
>
> So i don't really understand what MySQL internally does because i  
> only see
> collate as a ORDER BY issue but it seems to be more ...
>
> vg  Steffen
>

Hey Steffen,

Order by has a lot to do with comparing (you need to compare first  
before you can order ;) ) and that is exactly what you are doing.
You wanted to compare two strings....

Ries









More information about the TYPO3-dev mailing list