This Unicode is above 2047 and more than 11 bits have to be coded. This needs three UTF-8 bytes. The header byte starts with "1110" showing that the multibyte code consists of 3 bytes. 4 bits (blue) space is left for the Unicode number. The two following bytes start with "10" and can hold 6 bits each (magenta and green) - all together 4+6+6=16. Hence, a three byte UTF-8 multibyte code represents Unicode characters up to the number 65535.











HTML-Entity UTF-8 Converter


 euro sign <= iacute > iacute
Unicode
 decimal 8364 
 hexadec. 20ac 
 bin(16)0010000010101100 
=>Utf8
 UTF-8/1 (226) 11100010 
 UTF-8/2 (130) 10000010 
 UTF-8/3 (172) 10101100 
HTML-Entity
Unicode Hexadec.
Unicode Character
Unicode Decimal

How can I change UTF8 coded German 'Umlaute' in a string to CP 1252 chars using PHP?

$utf8_c = array (chr(195).chr(132), chr(195).chr(150), chr(195).chr(156), chr(195).chr(164), chr(195).chr(182), chr(195).chr(188), chr(195).chr(159))
$cp1252 = array("Ä", "Ö", "Ü", "ä", "ö", "ü", "ß");
$body = str_replace($utf8_c, $cp1252, $body);