@ -1715,12 +1715,12 @@ function api_in_array_nocase($needle, $haystack, $strict = false, $encoding = nu
//----------------------------------------------------------------------------
// Transliteration, converting UTF-8 strings to ASCII strings
// Transliteration, converting ANSI and UTF-8 strings to ASCII strings
//----------------------------------------------------------------------------
/**
* Transliterates a UTF-8 input string to a plain ASCII string.
* Transliterates a string to a plain ASCII string.
*
* Example:
* echo api_transliterate(api_html_entity_decode(
@ -1730,8 +1730,9 @@ function api_in_array_nocase($needle, $haystack, $strict = false, $encoding = nu
* ENT_QUOTES, 'UTF-8'), 'UTF-8');
* The output should be: Fyodor Mihaylovich Dostoevkiy
*
* @param string $string The UTF-8 text input.
* @param string $string The input string .
* @param string $unknown Replacement character for unknown characters and illegal UTF-8 sequences.
* @param string $from_encoding The encoding of the input string. If it is omited, the platform character set is assumed.
* @return string Plain ASCII output.
*
* Based on Drupal's module "Transliteration", version 6.x-2.1, 09-JUN-2009:
@ -1761,12 +1762,12 @@ function api_transliterate($string, $unknown = '?', $from_encoding = null) {
return $string;
}
static $tailB ytes;
static $tail_b ytes;
if (!isset($tailB ytes)) {
if (!isset($tail_b ytes)) {
// Each UTF-8 head byte is followed by a certain
// number of tail bytes.
$tailB ytes = array();
$tail_b ytes = array();
for ($n = 0; $n < 256 ; $ n + + ) {
if ($n < 0xc0 ) {
$remaining = 0;
@ -1788,7 +1789,7 @@ function api_transliterate($string, $unknown = '?', $from_encoding = null) {
} else {
$remaining = 0;
}
$tailB ytes[chr($n)] = $remaining;
$tail_b ytes[chr($n)] = $remaining;
}
}
@ -1821,7 +1822,7 @@ function api_transliterate($string, $unknown = '?', $from_encoding = null) {
for ($i = -1; --$len; ) {
$c = $str{++$i};
if ($remaining = $tailB ytes[$c]) {
if ($remaining = $tail_b ytes[$c]) {
// UTF-8 head byte!
$sequence = $head = $c;
do {