michaelfox + unicode   10

unicode decode — Gist
<?php
function uniDecode($str,$charcode){
$text = preg_replace_callback("/%u[0-9A-Za-z]{4}/",'toUtf8',$str);
return mb_convert_encoding($text, $charcode, 'utf-8');
}
function toUtf8($ar){
$c = null;
foreach($ar as $val){
$val = intval(substr($val,2),16);
if($val < 0x7F){ // 0000-007F
$c .= chr($val);
}elseif($val < 0x800) { // 0080-0800
$c .= chr(0xC0 | ($val / 64));
$c .= chr(0x80 | ($val % 64));
}else{ // 0800-FFFF
$c .= chr(0xE0 | (($val / 64) / 64));
$c .= chr(0x80 | (($val / 64) % 64));
$c .= chr(0x80 | ($val % 64));
}
}
return $c;
}
php  utf8  unicode  charset 
march 2011 by michaelfox
Unicode code converter [ishida >> utilities]
ype or paste text in any of the green or grey shaded boxes and click on the button Convert button above it. Alternative representations will appear in all the other boxes. You can then cut & paste the results into your document. Select selects all the text in a box. Scroll down the page for notes on other options.
tools  unicode  ascii  encoding  html  converter  utf-8 
august 2010 by michaelfox

Copy this bookmark:



description:


tags: