[TYPO3-dev] MySQL First Letter and Umlauts

Steffen Kamper steffen at sk-typo3.de
Fri Oct 26 17:27:57 CEST 2007


"Martin Kutschker" <martin.kutschker-n0spam at no5pam-blackbox.net> schrieb im 
Newsbeitrag news:mailman.1.1193407625.8590.typo3-dev at lists.netfielders.de...
> Steffen Kamper schrieb:
>> Hi,
>>
>> i need a tip for an alphabetic List in mySQL (all in utf8).
>>
>> I did this (for drwiki)
>> SELECT DISTINCT keyword,ASCII(UPPER(SUBSTRING(keyword,1,1))) letter FROM 
>> `tx_drwiki_pages` ORDER BY letter
>
> May I ask why you need the ASCII? UPPER(LEFT(keyword,1)) will already get 
> you the letter. I fail to see the point, but maybe COLLATE is your friend:
>
> ORDER BY letter COLLATE latin1_german2_ci;
>
> Strictly speaking there is no ASCII value für umlauts anyway as true ASCII 
> uses only 7-bit (max. number 127). But maybe it helps is you cast the 
> value from utf8 to latin before you apply the ASCII:
>
> ASCII(CONVERT(UPPER(LEFT(keyword,1)) USING latin1));
>
> Masi

Hi Masi,

the Reason for using ASCII is following: Starting with A (ASCII 65) all 
values lower the 65 becomes section 0-9, it's just for easy determination.
ASCII(CONVERT(UPPER(LEFT(keyword,1)) USING latin1)); - i tried this but it 
change nothing, hving Ä (&Auml;) at the beginning will result the same.

vg  Steffen 






More information about the TYPO3-dev mailing list