nntp2http.com
Posting
Suche
Optionen
Hilfe & Kontakt

Re: mysql / UTF-8

Von: Thomas Rachel (glglgl@expires-2008-01-31.arcornews.de) [Profil]
Datum: 07.02.2008 10:15
Message-ID: <foei7q$5al$1@svr7.m-online.net>
Newsgroup: de.comp.datenbanken.mysql
Günter Baier schrieb:

>>
>> Was gibt denn SELECT ORD('Ä'), ORD('ä'); ?
>>
>> schöne grüße, steffen
>
>
> Da bekomme ich
>
> 50052      50084
>
> als Ergebnis -> was genau bedeutet das?

50052 ist, in Hex ausgedrückt, die Zahl 0xc384.

Bei mir (MySQL 5.0.26) ergibt die Befehlsfolge

set names utf8;
select ord('Ä');
set names latin1;
select ord('Ä');

die Ausgaben 50052 und 195 (in dieser Reihenfolge).

D.h. einmal die Bytes in UTF8 und einmal in Latin1.

Entspricht auch der Funktionsbeschreibung laut help ord:

| If the leftmost character of the string str is a multi-byte character,
| returns the code for that character, calculated from the numeric
| values of its constituent bytes using this formula:
|
|  (1st byte code)
| + (2nd byte code x 256)
| + (3rd byte code x 256^2) ...
|
| If the leftmost character is not a multi-byte character, ORD() returns
| the same value as the ASCII() function.


Thomas

[ Auf dieses Posting antworten ]