return true;
}
- /**
- * Convert a hex string representing a Unicode code point to that code point.
- * @param string $c
- * @return string|false
- */
- protected function unicodeChar( $c ) {
- $c = hexdec( $c );
- if ( $c <= 0x7F ) {
- return chr( $c );
- } elseif ( $c <= 0x7FF ) {
- return chr( 0xC0 | $c >> 6 ) . chr( 0x80 | $c & 0x3F );
- } elseif ( $c <= 0xFFFF ) {
- return chr( 0xE0 | $c >> 12 ) . chr( 0x80 | $c >> 6 & 0x3F ) .
- chr( 0x80 | $c & 0x3F );
- } elseif ( $c <= 0x10FFFF ) {
- return chr( 0xF0 | $c >> 18 ) . chr( 0x80 | $c >> 12 & 0x3F ) .
- chr( 0x80 | $c >> 6 & 0x3F ) .
- chr( 0x80 | $c & 0x3F );
- } else {
- return false;
- }
- }
-
/**
* Check the libicu version
*/
* Note that we use the hex representation to create the code
* points in order to avoid any Unicode-destroying during transit.
*/
- $not_normal_c = $this->unicodeChar( "FA6C" );
- $normal_c = $this->unicodeChar( "242EE" );
+ $not_normal_c = "\u{FA6C}";
+ $normal_c = "\u{242EE}";
$useNormalizer = 'php';
$needsUpdate = false;
$pixels = $l10n->msg( 'unit-pixel' )->text();
foreach ( $this->config->get( 'ImageLimits' ) as $index => $limits ) {
- // Note: A left-to-right marker (\u200e) is inserted, see T144386
- $display = "{$limits[0]}" . json_decode( '"\u200e"' ) . "×{$limits[1]}" . $pixels;
+ // Note: A left-to-right marker (U+200E) is inserted, see T144386
+ $display = "{$limits[0]}\u{200E}×{$limits[1]}$pixels";
$ret[$display] = $index;
}
// unicode chars
[
- self::createUnicodeString( '`\u0001a\uFFFFb`' ),
- self::createUnicodeString( '\u0001a\uFFFFb' )
+ "`\u{0001}a\u{FFFF}b`",
+ "\u{0001}a\u{FFFF}b"
],
[
- self::createUnicodeString( '`\u0001\uFFFF`' ),
- self::createUnicodeString( '\u0001\u0000\uFFFF\u0000' )
+ "`\u{0001}\u{FFFF}`",
+ "\u{0001}\u{0000}\u{FFFF}\u{0000}"
],
[ '`☃`', '☃' ],
[ '`メインページ`', 'メインページ' ],
];
}
- private static function createUnicodeString( $str ) {
- return json_decode( '"' . $str . '"' );
- }
-
private function getMockForViews() {
$db = $this->getMockBuilder( DatabaseMysqli::class )
->disableOriginalConstructor()