Example #1
0
        for ($cnt = 0; $cnt < $len; $cnt++) {
            $c = Reform::uniord(Reform::unicharat($str, $cnt));
            if ($c >= 97 && $c <= 122 || $c >= 65 && $c <= 90 || $c >= 48 && $c <= 57 || $c == 32 || $c == 44 || $c == 46) {
                if (!$inStr) {
                    $inStr = true;
                    $out .= '&"';
                }
                $out .= Reform::unicharat($str, $cnt);
            } else {
                if (!$inStr) {
                    $out .= sprintf('&chrw(%d)', $c);
                } else {
                    $out .= sprintf('"&chrw(%d)', $c);
                    $inStr = false;
                }
            }
        }
        return ltrim($out, '&') . ($inStr ? '"' : '');
    }
}
Reform::$haveUnicode = false;
if (function_exists('mb_convert_encoding')) {
    if (mb_internal_encoding() == "UTF-8") {
        Reform::$haveUnicode = true;
    } else {
        trigger_error("Reform requires UTF-8 internal encoding, disabling unicode support", E_USER_WARNING);
    }
} else {
    trigger_error("Reform unicode support requires multibute string module, disabling unicode support", E_USER_WARNING);
}
// end