phpBB

Code Changes

File: includes/utf/utf_tools.php

  Unmodified   Added   Modified   Removed
Line 415Line 415

// Trigger an error?! Fow now just give bad data :-(
trigger_error('Unknown encoding: ' . $encoding, E_USER_ERROR);


// Trigger an error?! Fow now just give bad data :-(
trigger_error('Unknown encoding: ' . $encoding, E_USER_ERROR);

 
}

/**
* Replace some special UTF-8 chars that are not in ASCII with their UCR.
* using their Numeric Character Reference's Hexadecimal notation.
*
* Doesn't interfere with Japanese or Cyrillic etc.
* Unicode character visualization will depend on the character support
* of your web browser and the fonts installed on your system.
*
* @see https://en.wikibooks.org/wiki/Unicode/Character_reference/1F000-1FFFF
*
* @param string $text UTF-8 string in NFC
* @return string ASCII string using NCR for non-ASCII chars
*/
function utf8_encode_ucr($text)
{
return preg_replace_callback('/[\\xF0-\\xF4].../', 'utf8_encode_ncr_callback', $text);

}

/**
* Replace all UTF-8 chars that are not in ASCII with their NCR

}

/**
* Replace all UTF-8 chars that are not in ASCII with their NCR

 
 * using their Numeric Character Reference's Hexadecimal notation.

*
* @param string $text UTF-8 string in NFC
* @return string ASCII string using NCRs for non-ASCII chars

*
* @param string $text UTF-8 string in NFC
* @return string ASCII string using NCRs for non-ASCII chars

Line 429Line 448
}

/**

}

/**

* Callback used in encode_ncr()

 * Callback used in utf8_encode_ncr() and utf8_encode_ucr()

*
* Takes a UTF-8 char and replaces it with its NCR. Attention, $m is an array
*

*
* Takes a UTF-8 char and replaces it with its NCR. Attention, $m is an array
*

Line 1390Line 1409
	{
$words = explode(' ', $line);


	{
$words = explode(' ', $line);


		for ($i = 0, $size = sizeof($words); $i < $size; $i++)

		for ($i = 0, $size = count($words); $i < $size; $i++)

		{
$word = $words[$i];


		{
$word = $words[$i];