Use PHP 7 "\u{NNNN}" Unicode codepoint escapes in string literals

In cases where we're operating on text data (and not binary data),
use e.g. "\u{00A0}" to refer directly to the Unicode character
'NO-BREAK SPACE' instead of "\xc2\xa0" to specify the bytes C2h A0h
(which correspond to the UTF-8 encoding of that character). This
makes it easier to look up those mysterious sequences, as not all
are as recognizable as the no-break space.

This is not enforced by PHP, but I think we should write those in
uppercase and zero-padded to at least four characters, like the
Unicode standard does.

Note that not all "\xNN" escapes can be automatically replaced:
* We can't use Unicode escapes for binary data that is not UTF-8
  (e.g. in code converting from legacy encodings or testing the
  handling of invalid UTF-8 byte sequences).
* '\xNN' escapes in regular expressions in single-quoted strings
  are actually handled by PCRE and have to be dealt with carefully
  (those regexps should probably be changed to use the /u modifier).
* "\xNN" referring to ASCII characters ("\x7F" and lower) should
  probably be left as-is.

The replacements in this commit were done semi-manually by piping
the existing "\xNN" escapes through the following terrible Ruby
script I devised:

  chars = eval('"' + ARGV[0] + '"').force_encoding('utf-8')
  puts chars.split('').map{|char|
    '\\u{' + char.ord.to_s(16).upcase.rjust(4, '0') + '}'
  }.join('')

Change-Id: Idc3dee3a7fb5ebfaef395754d8859b18f1f8769a
This commit is contained in:
Bartosz Dziewoński 2017-10-07 02:26:23 +02:00 committed by Jforrester
parent 4d5b2473a4
commit 0313128b10
57 changed files with 144 additions and 144 deletions

View file

@ -836,9 +836,9 @@ class MessageCache {
],
[
' ',
"\xc2\xa0",
"\xc2\xa0",
"\xc2\xad"
"\u{00A0}",
"\u{00A0}",
"\u{00AD}"
],
$message
);

View file

@ -94,7 +94,7 @@ class IcuCollation extends Collation {
'af' => [],
'am' => [],
'ar' => [],
'as' => [ "\xe0\xa6\x82", "\xe0\xa6\x81", "\xe0\xa6\x83", "\xe0\xa7\x8e", "ক্ষ " ],
'as' => [ "\u{0982}", "\u{0981}", "\u{0983}", "\u{09CE}", "ক্ষ " ],
'ast' => [ "Ch", "Ll", "Ñ" ], // not in libicu
'az' => [ "Ç", "Ə", "Ğ", "İ", "Ö", "Ş", "Ü" ],
'be' => [ "Ё" ],
@ -144,11 +144,11 @@ class IcuCollation extends Collation {
'ga' => [],
'gd' => [], // not in libicu
'gl' => [ "Ch", "Ll", "Ñ" ],
'gu' => [ "\xe0\xaa\x82", "\xe0\xaa\x83", "\xe0\xaa\x81", "\xe0\xaa\xb3" ],
'gu' => [ "\u{0A82}", "\u{0A83}", "\u{0A81}", "\u{0AB3}" ],
'ha' => [ 'Ɓ', 'Ɗ', 'Ƙ', 'Sh', 'Ts', 'Ƴ' ],
'haw' => [ 'ʻ' ],
'he' => [],
'hi' => [ "\xe0\xa4\x82", "\xe0\xa4\x83" ],
'hi' => [ "\u{0902}", "\u{0903}" ],
'hr' => [ "Č", "Ć", "", "Đ", "Lj", "Nj", "Š", "Ž" ],
'hsb' => [ "Č", "", "Ě", "Ch", "Ł", "Ń", "Ř", "Š", "Ć", "Ž" ],
'hu' => [ "Cs", "Dz", "Dzs", "Gy", "Ly", "Ny", "Ö", "Sz", "Ty", "Ü", "Zs" ],
@ -161,13 +161,13 @@ class IcuCollation extends Collation {
'kk' => [ "Ү", "І" ],
'kl' => [ "Æ", "Ø", "Å" ],
'km' => [
"", "", "", "", "", "", "\xe1\x9e\xbb\xe1\x9f\x86",
"\xe1\x9f\x86", "\xe1\x9e\xb6\xe1\x9f\x86", "\xe1\x9f\x87",
"\xe1\x9e\xb7\xe1\x9f\x87", "\xe1\x9e\xbb\xe1\x9f\x87",
"\xe1\x9f\x81\xe1\x9f\x87", "\xe1\x9f\x84\xe1\x9f\x87",
"", "", "", "", "", "", "\u{17BB}\u{17C6}",
"\u{17C6}", "\u{17B6}\u{17C6}", "\u{17C7}",
"\u{17B7}\u{17C7}", "\u{17BB}\u{17C7}",
"\u{17C1}\u{17C7}", "\u{17C4}\u{17C7}",
],
'kn' => [ "\xe0\xb2\x81", "\xe0\xb2\x83", "\xe0\xb3\xb1", "\xe0\xb3\xb2" ],
'kok' => [ "\xe0\xa4\x82", "\xe0\xa4\x83", "", "क्ष" ],
'kn' => [ "\u{0C81}", "\u{0C83}", "\u{0CF1}", "\u{0CF2}" ],
'kok' => [ "\u{0902}", "\u{0903}", "", "क्ष" ],
'ku' => [ "Ç", "Ê", "Î", "Ş", "Û" ], // not in libicu
'ky' => [ "Ё" ],
'la' => [], // not in libicu
@ -181,7 +181,7 @@ class IcuCollation extends Collation {
'ml' => [],
'mn' => [],
'mo' => [ "Ă", "Â", "Î", "Ș", "Ț" ], // not in libicu
'mr' => [ "\xe0\xa4\x82", "\xe0\xa4\x83", "", "क्ष", "ज्ञ" ],
'mr' => [ "\u{0902}", "\u{0903}", "", "क्ष", "ज्ञ" ],
'ms' => [],
'mt' => [ "Ċ", "Ġ", "", "Ħ", "Ż" ],
'nb' => [ "Æ", "Ø", "Å" ],
@ -191,8 +191,8 @@ class IcuCollation extends Collation {
'no' => [ "Æ", "Ø", "Å" ], // not in libicu. You should probably use nb or nn instead.
'oc' => [], // not in libicu
'om' => [ 'Ch', 'Dh', 'Kh', 'Ny', 'Ph', 'Sh' ],
'or' => [ "\xe0\xac\x81", "\xe0\xac\x82", "\xe0\xac\x83", "କ୍ଷ" ],
'pa' => [ "\xe0\xa9\x8d" ],
'or' => [ "\u{0B01}", "\u{0B02}", "\u{0B03}", "କ୍ଷ" ],
'pa' => [ "\u{0A4D}" ],
'pl' => [ "Ą", "Ć", "Ę", "Ł", "Ń", "Ó", "Ś", "Ź", "Ż" ],
'pt' => [],
'rm' => [], // not in libicu
@ -204,7 +204,7 @@ class IcuCollation extends Collation {
'Á', 'Č', 'Ʒ', 'Ǯ', 'Đ', 'Ǧ', 'Ǥ', 'Ǩ', 'Ŋ',
'Š', 'Ŧ', 'Ž', 'Ø', 'Æ', 'Ȧ', 'Ä', 'Ö'
],
'si' => [ "\xe0\xb6\x82", "\xe0\xb6\x83", "\xe0\xb6\xa4" ],
'si' => [ "\u{0D82}", "\u{0D83}", "\u{0DA4}" ],
'sk' => [ "Ä", "Č", "Ch", "Ô", "Š", "Ž" ],
'sl' => [ "Č", "Š", "Ž" ],
'smn' => [ "Á", "Č", "Đ", "Ŋ", "Š", "Ŧ", "Ž", "Æ", "Ø", "Å", "Ä", "Ö" ],
@ -215,12 +215,12 @@ class IcuCollation extends Collation {
'sv@collation=standard' => [ "Å", "Ä", "Ö" ],
'sw' => [],
'ta' => [
"\xE0\xAE\x82", "", "க்ஷ", "க்", "ங்", "ச்", "ஞ்", "ட்", "ண்", "த்", "ந்",
"\u{0B82}", "", "க்ஷ", "க்", "ங்", "ச்", "ஞ்", "ட்", "ண்", "த்", "ந்",
"ப்", "ம்", "ய்", "ர்", "ல்", "வ்", "ழ்", "ள்", "ற்", "ன்", "ஜ்", "ஶ்", "ஷ்",
"ஸ்", "ஹ்", "க்ஷ்"
],
'te' => [ "\xe0\xb0\x81", "\xe0\xb0\x82", "\xe0\xb0\x83" ],
'th' => [ "", "\xe0\xb9\x86", "\xe0\xb9\x8d", "\xe0\xb8\xba" ],
'te' => [ "\u{0C01}", "\u{0C02}", "\u{0C03}" ],
'th' => [ "", "\u{0E46}", "\u{0E4D}", "\u{0E3A}" ],
'tk' => [ "Ç", "Ä", "Ž", "Ň", "Ö", "Ş", "Ü", "Ý" ],
'tl' => [ "Ñ", "Ng" ], // not in libicu
'to' => [ "Ng", "ʻ" ],
@ -231,8 +231,8 @@ class IcuCollation extends Collation {
'vi' => [ "Ă", "Â", "Đ", "Ê", "Ô", "Ơ", "Ư" ],
'vo' => [ "Ä", "Ö", "Ü" ],
'yi' => [
"\xd7\x91\xd6\xbf", "\xd7\x9b\xd6\xbc", "\xd7\xa4\xd6\xbc",
"\xd7\xa9\xd7\x82", "\xd7\xaa\xd6\xbc"
"\u{05D1}\u{05BF}", "\u{05DB}\u{05BC}", "\u{05E4}\u{05BC}",
"\u{05E9}\u{05C2}", "\u{05EA}\u{05BC}"
],
'yo' => [ "", "Gb", "", "" ],
'zu' => [],

View file

@ -811,7 +811,7 @@ abstract class Installer {
// with utf8 support, but not unicode property support.
// check that \p{Zs} (space separators) matches
// U+3000 (Ideographic space)
$regexprop = preg_replace( '/\p{Zs}/u', '', "-\xE3\x80\x80-" );
$regexprop = preg_replace( '/\p{Zs}/u', '', "-\u{3000}-" );
Wikimedia\restoreWarnings();
if ( $regexd != '--' || $regexprop != '--' ) {
$this->showError( 'config-pcre-no-utf8' );

View file

@ -84,8 +84,8 @@ class FormatJson {
* and U+000D (CR). However, PHP already escapes LF and CR according to RFC 4627.
*/
private static $badChars = [
"\xe2\x80\xa8", // U+2028 LINE SEPARATOR
"\xe2\x80\xa9", // U+2029 PARAGRAPH SEPARATOR
"\u{2028}", // U+2028 LINE SEPARATOR
"\u{2029}", // U+2029 PARAGRAPH SEPARATOR
];
/**

View file

@ -179,7 +179,7 @@ class CSSMin {
* @return string
*/
public static function serializeStringValue( $value ) {
$value = strtr( $value, [ "\0" => "\xEF\xBF\xBD", '\\' => '\\\\', '"' => '\\"' ] );
$value = strtr( $value, [ "\0" => "\u{FFFD}", '\\' => '\\\\', '"' => '\\"' ] );
$value = preg_replace_callback( '/[\x01-\x1f\x7f]/', function ( $match ) {
return '\\' . base_convert( ord( $match[0] ), 10, 16 ) . ' ';
}, $value );

View file

@ -186,7 +186,7 @@ class Licenses extends HTMLFormField {
$attribs['selected'] = 'selected';
}
$val = str_repeat( /* &nbsp */ "\xc2\xa0", $depth * 2 ) . $text;
$val = str_repeat( /* &nbsp */ "\u{00A0}", $depth * 2 ) . $text;
return str_repeat( "\t", $depth ) . Xml::element( 'option', $attribs, $val ) . "\n";
}

View file

@ -18,9 +18,9 @@ class RemexCompatFormatter extends HtmlFormatter {
public function __construct( $options = [] ) {
parent::__construct( $options );
$this->attributeEscapes["\xc2\xa0"] = ' ';
$this->attributeEscapes["\u{00A0}"] = ' ';
unset( $this->attributeEscapes["&"] );
$this->textEscapes["\xc2\xa0"] = ' ';
$this->textEscapes["\u{00A0}"] = ' ';
unset( $this->textEscapes["&"] );
}

View file

@ -154,9 +154,9 @@ class Language {
/**
* Unicode directional formatting characters, for embedBidi()
*/
static private $lre = "\xE2\x80\xAA"; // U+202A LEFT-TO-RIGHT EMBEDDING
static private $rle = "\xE2\x80\xAB"; // U+202B RIGHT-TO-LEFT EMBEDDING
static private $pdf = "\xE2\x80\xAC"; // U+202C POP DIRECTIONAL FORMATTING
static private $lre = "\u{202A}"; // U+202A LEFT-TO-RIGHT EMBEDDING
static private $rle = "\u{202B}"; // U+202B RIGHT-TO-LEFT EMBEDDING
static private $pdf = "\u{202C}"; // U+202C POP DIRECTIONAL FORMATTING
/**
* Directionality test regex for embedBidi(). Matches the first strong directionality codepoint:
@ -2915,33 +2915,33 @@ class Language {
if ( $code < 0xac00 || 0xd7a4 <= $code ) {
return $matches[1];
} elseif ( $code < 0xb098 ) {
return "\xe3\x84\xb1";
return "\u{3131}";
} elseif ( $code < 0xb2e4 ) {
return "\xe3\x84\xb4";
return "\u{3134}";
} elseif ( $code < 0xb77c ) {
return "\xe3\x84\xb7";
return "\u{3137}";
} elseif ( $code < 0xb9c8 ) {
return "\xe3\x84\xb9";
return "\u{3139}";
} elseif ( $code < 0xbc14 ) {
return "\xe3\x85\x81";
return "\u{3141}";
} elseif ( $code < 0xc0ac ) {
return "\xe3\x85\x82";
return "\u{3142}";
} elseif ( $code < 0xc544 ) {
return "\xe3\x85\x85";
return "\u{3145}";
} elseif ( $code < 0xc790 ) {
return "\xe3\x85\x87";
return "\u{3147}";
} elseif ( $code < 0xcc28 ) {
return "\xe3\x85\x88";
return "\u{3148}";
} elseif ( $code < 0xce74 ) {
return "\xe3\x85\x8a";
return "\u{314A}";
} elseif ( $code < 0xd0c0 ) {
return "\xe3\x85\x8b";
return "\u{314B}";
} elseif ( $code < 0xd30c ) {
return "\xe3\x85\x8c";
return "\u{314C}";
} elseif ( $code < 0xd558 ) {
return "\xe3\x85\x8d";
return "\u{314D}";
} else {
return "\xe3\x85\x8e";
return "\u{314E}";
}
} else {
return '';
@ -3088,8 +3088,8 @@ class Language {
* @return string
*/
function getDirMark( $opposite = false ) {
$lrm = "\xE2\x80\x8E"; # LEFT-TO-RIGHT MARK, commonly abbreviated LRM
$rlm = "\xE2\x80\x8F"; # RIGHT-TO-LEFT MARK, commonly abbreviated RLM
$lrm = "\u{200E}"; # LEFT-TO-RIGHT MARK, commonly abbreviated LRM
$rlm = "\u{200F}"; # RIGHT-TO-LEFT MARK, commonly abbreviated RLM
if ( $opposite ) {
return $this->isRTL() ? $lrm : $rlm;
}

View file

@ -29,8 +29,8 @@ namespace MediaWiki\Languages\Data;
* These determine things like interwikis, language selectors, and so on.
* Safe to change without running scripts on the respective sites.
*
* \xE2\x80\x8E is the left-to-right marker and
* \xE2\x80\x8F is the right-to-left marker.
* \u{200E} is the left-to-right marker and
* \u{200F} is the right-to-left marker.
* They are required for ensuring the correct display of brackets in
* mixed rtl/ltr environment.
*
@ -88,8 +88,8 @@ class Names {
'bcc' => 'جهلسری بلوچی', # Southern Balochi
'bcl' => 'Bikol Central', # Bikol: Central Bicolano language
'be' => 'беларуская', # Belarusian normative
'be-tarask' => "беларуская (тарашкевіца)\xE2\x80\x8E", # Belarusian in Taraskievica orthography
'be-x-old' => "беларуская (тарашкевіца)\xE2\x80\x8E", # (be-tarask compat)
'be-tarask' => "беларуская (тарашкевіца)\u{200E}", # Belarusian in Taraskievica orthography
'be-x-old' => "беларуская (тарашкевіца)\u{200E}", # (be-tarask compat)
'bg' => 'български', # Bulgarian
'bgn' => 'روچ کپتین بلوچی', # Western Balochi
'bh' => 'भोजपुरी', # Bihari macro language. Falls back to Bhojpuri (bho)
@ -122,8 +122,8 @@ class Names {
'cps' => 'Capiceño', # Capiznon
'cr' => 'Nēhiyawēwin / ᓀᐦᐃᔭᐍᐏᐣ', # Cree
'crh' => 'qırımtatarca', # Crimean Tatar (multiple scripts - defaults to Latin)
'crh-latn' => "qırımtatarca (Latin)\xE2\x80\x8E", # Crimean Tatar (Latin)
'crh-cyrl' => "къырымтатарджа (Кирилл)\xE2\x80\x8E", # Crimean Tatar (Cyrillic)
'crh-latn' => "qırımtatarca (Latin)\u{200E}", # Crimean Tatar (Latin)
'crh-cyrl' => "къырымтатарджа (Кирилл)\u{200E}", # Crimean Tatar (Cyrillic)
'cs' => 'čeština', # Czech
'csb' => 'kaszëbsczi', # Cassubian
'cu' => 'словѣньскъ / ⰔⰎⰑⰂⰡⰐⰠⰔⰍⰟ', # Old Church Slavonic (ancient language)
@ -133,7 +133,7 @@ class Names {
'de' => 'Deutsch', # German ("Du")
'de-at' => 'Österreichisches Deutsch', # Austrian German
'de-ch' => 'Schweizer Hochdeutsch', # Swiss Standard German
'de-formal' => "Deutsch (Sie-Form)\xE2\x80\x8E", # German - formal address ("Sie")
'de-formal' => "Deutsch (Sie-Form)\u{200E}", # German - formal address ("Sie")
'din' => 'Thuɔŋjäŋ', # Dinka
'diq' => 'Zazaki', # Zazaki
'dsb' => 'dolnoserbski', # Lower Sorbian
@ -150,7 +150,7 @@ class Names {
'en-gb' => 'British English', # British English
'eo' => 'Esperanto', # Esperanto
'es' => 'español', # Spanish
'es-formal' => "español (formal)\xE2\x80\x8E", # Spanish formal address
'es-formal' => "español (formal)\u{200E}", # Spanish formal address
'et' => 'eesti', # Estonian
'eu' => 'euskara', # Basque
'ext' => 'estremeñu', # Extremaduran
@ -170,8 +170,8 @@ class Names {
'ga' => 'Gaeilge', # Irish
'gag' => 'Gagauz', # Gagauz
'gan' => '贛語', # Gan (multiple scripts - defaults to Traditional)
'gan-hans' => "赣语(简体)\xE2\x80\x8E", # Gan (Simplified Han)
'gan-hant' => "贛語(繁體)\xE2\x80\x8E", # Gan (Traditional Han)
'gan-hans' => "赣语(简体)\u{200E}", # Gan (Simplified Han)
'gan-hant' => "贛語(繁體)\u{200E}", # Gan (Traditional Han)
'gcr' => 'kréyòl gwiyanè', # Guianan Creole
'gd' => 'Gàidhlig', # Scots Gaelic
'gl' => 'galego', # Galician
@ -200,7 +200,7 @@ class Names {
'hsb' => 'hornjoserbsce', # Upper Sorbian
'ht' => 'Kreyòl ayisyen', # Haitian Creole French
'hu' => 'magyar', # Hungarian
'hu-formal' => "magyar (formal)\xE2\x80\x8E", # Hungarian formal address
'hu-formal' => "magyar (formal)\u{200E}", # Hungarian formal address
'hy' => 'Հայերեն', # Armenian
'hz' => 'Otsiherero', # Herero
'ia' => 'interlingua', # Interlingua (IALA)
@ -234,12 +234,12 @@ class Names {
'kiu' => 'Kırmancki', # Kirmanjki
'kj' => 'Kwanyama', # Kwanyama
'kk' => 'қазақша', # Kazakh (multiple scripts - defaults to Cyrillic)
'kk-arab' => "قازاقشا (تٴوتە)\xE2\x80\x8F", # Kazakh Arabic
'kk-cyrl' => "қазақша (кирил)\xE2\x80\x8E", # Kazakh Cyrillic
'kk-latn' => "qazaqşa (latın)\xE2\x80\x8E", # Kazakh Latin
'kk-cn' => "قازاقشا (جۇنگو)\xE2\x80\x8F", # Kazakh (China)
'kk-kz' => "қазақша (Қазақстан)\xE2\x80\x8E", # Kazakh (Kazakhstan)
'kk-tr' => "qazaqşa (Türkïya)\xE2\x80\x8E", # Kazakh (Turkey)
'kk-arab' => "قازاقشا (تٴوتە)\u{200F}", # Kazakh Arabic
'kk-cyrl' => "қазақша (кирил)\u{200E}", # Kazakh Cyrillic
'kk-latn' => "qazaqşa (latın)\u{200E}", # Kazakh Latin
'kk-cn' => "قازاقشا (جۇنگو)\u{200F}", # Kazakh (China)
'kk-kz' => "қазақша (Қазақстан)\u{200E}", # Kazakh (Kazakhstan)
'kk-tr' => "qazaqşa (Türkïya)\u{200E}", # Kazakh (Turkey)
'kl' => 'kalaallisut', # Inuktitut, Greenlandic/Greenlandic/Kalaallisut (kal)
'km' => 'ភាសាខ្មែរ', # Khmer, Central
'kn' => 'ಕನ್ನಡ', # Kannada
@ -256,8 +256,8 @@ class Names {
'ks-deva' => 'कॉशुर', # Kashmiri (Devanagari script)
'ksh' => 'Ripoarisch', # Ripuarian
'ku' => 'kurdî', # Kurdish (multiple scripts - defaults to Latin)
'ku-latn' => "kurdî (latînî)\xE2\x80\x8E", # Northern Kurdish (Latin script)
'ku-arab' => "كوردي (عەرەبی)\xE2\x80\x8F", # Northern Kurdish (Arabic script) (falls back to ckb)
'ku-latn' => "kurdî (latînî)\u{200E}", # Northern Kurdish (Latin script)
'ku-arab' => "كوردي (عەرەبی)\u{200F}", # Northern Kurdish (Arabic script) (falls back to ckb)
'kum' => 'къумукъ', # Kumyk (Cyrillic, 'kum-latn' for Latin script)
'kv' => 'коми', # Komi-Zyrian (Cyrillic is common script but also written in Latin script)
'kw' => 'kernowek', # Cornish
@ -318,7 +318,7 @@ class Names {
'ng' => 'Oshiwambo', # Ndonga
'niu' => 'Niuē', # Niuean
'nl' => 'Nederlands', # Dutch
'nl-informal' => "Nederlands (informeel)\xE2\x80\x8E", # Dutch (informal address ("je"))
'nl-informal' => "Nederlands (informeel)\u{200E}", # Dutch (informal address ("je"))
'nn' => 'norsk nynorsk', # Norwegian (Nynorsk)
'no' => 'norsk', # Norwegian macro language (falls back to nb).
'nov' => 'Novial', # Novial
@ -401,8 +401,8 @@ class Names {
'so' => 'Soomaaliga', # Somali
'sq' => 'shqip', # Albanian
'sr' => 'српски / srpski', # Serbian (multiple scripts - defaults to Cyrillic)
'sr-ec' => "српски (ћирилица)\xE2\x80\x8E", # Serbian Cyrillic ekavian
'sr-el' => "srpski (latinica)\xE2\x80\x8E", # Serbian Latin ekavian
'sr-ec' => "српски (ћирилица)\u{200E}", # Serbian Cyrillic ekavian
'sr-el' => "srpski (latinica)\u{200E}", # Serbian Latin ekavian
'srn' => 'Sranantongo', # Sranan Tongo
'ss' => 'SiSwati', # Swati
'st' => 'Sesotho', # Southern Sotho
@ -471,15 +471,15 @@ class Names {
'zea' => 'Zeêuws', # Zeeuws/Zeaws
'zh' => '中文', # (Zhōng Wén) - Chinese
'zh-classical' => '文言', # Classical Chinese/Literary Chinese -- (see T10217)
'zh-cn' => "中文(中国大陆)\xE2\x80\x8E", # Chinese (PRC)
'zh-hans' => "中文(简体)\xE2\x80\x8E", # Mandarin Chinese (Simplified Chinese script) (cmn-hans)
'zh-hant' => "中文(繁體)\xE2\x80\x8E", # Mandarin Chinese (Traditional Chinese script) (cmn-hant)
'zh-hk' => "中文(香港)\xE2\x80\x8E", # Chinese (Hong Kong)
'zh-cn' => "中文(中国大陆)\u{200E}", # Chinese (PRC)
'zh-hans' => "中文(简体)\u{200E}", # Mandarin Chinese (Simplified Chinese script) (cmn-hans)
'zh-hant' => "中文(繁體)\u{200E}", # Mandarin Chinese (Traditional Chinese script) (cmn-hant)
'zh-hk' => "中文(香港)\u{200E}", # Chinese (Hong Kong)
'zh-min-nan' => 'Bân-lâm-gú', # Min-nan -- (see T10217)
'zh-mo' => "中文(澳門)\xE2\x80\x8E", # Chinese (Macau)
'zh-my' => "中文(马来西亚)\xE2\x80\x8E", # Chinese (Malaysia)
'zh-sg' => "中文(新加坡)\xE2\x80\x8E", # Chinese (Singapore)
'zh-tw' => "中文(台灣)\xE2\x80\x8E", # Chinese (Taiwan)
'zh-mo' => "中文(澳門)\u{200E}", # Chinese (Macau)
'zh-my' => "中文(马来西亚)\u{200E}", # Chinese (Malaysia)
'zh-sg' => "中文(新加坡)\u{200E}", # Chinese (Singapore)
'zh-tw' => "中文(台灣)\u{200E}", # Chinese (Taiwan)
'zh-yue' => '粵語', # Cantonese -- (see T10217)
'zu' => 'isiZulu' # Zulu
];

View file

@ -194,5 +194,5 @@ $specialPageAliases = [
# South Africa uses space for thousands and comma for decimal
# Reference: AWS Reël 7.4 p. 52, 2002 edition
# glibc is wrong in this respect in some versions
$separatorTransformTable = [ ',' => "\xc2\xa0", '.' => ',' ];
$separatorTransformTable = [ ',' => "\u{00A0}", '.' => ',' ];
$linkTrail = "/^([a-z]+)(.*)$/sD";

View file

@ -65,7 +65,7 @@ $dateFormats = [
# Per discussion on https://translatewiki.net/wiki/Thread:Support/Customization_of number format
$separatorTransformTable = [
',' => "\xc2\xa0", # nbsp
',' => "\u{00A0}", # nbsp
'.' => ','
];

View file

@ -233,7 +233,7 @@ $dateFormats = [
];
$separatorTransformTable = [
',' => "\xc2\xa0", # nbsp
',' => "\u{00A0}", # nbsp
'.' => ','
];
$minimumGroupingDigits = 2;

View file

@ -217,5 +217,5 @@ $bookstoreList = [
$linkTrail = '/^([a-zабвгдежзийклмнопрстуфхцчшщъыьэюя]+)(.*)$/sDu';
$separatorTransformTable = [ ',' => "\xc2\xa0", '.' => ',' ];
$separatorTransformTable = [ ',' => "\u{00A0}", '.' => ',' ];
$minimumGroupingDigits = 2;

View file

@ -164,5 +164,5 @@ $dateFormats = [
'dmy both' => 'j M Y "da" H:i',
];
$separatorTransformTable = [ ',' => "\xc2\xa0", '.' => ',' ];
$separatorTransformTable = [ ',' => "\u{00A0}", '.' => ',' ];
$linkTrail = "/^((?:c\'h|C\'H|C\'h|ch|CH|Ch|[a-zA-ZàâçéèêîôûäëïöüùñÇÉÂÊÎÔÛÄËÏÖÜÀÈÙÑ])+)(.*)$/sDu";

View file

@ -383,4 +383,4 @@ $bookstoreList = [
# Písmena, která se mají objevit jako část odkazu ve formě '[[jazyk]]y' atd:
$linkTrail = '/^([a-záčďéěíňóřšťúůýž]+)(.*)$/sDu';
$separatorTransformTable = [ ',' => "\xc2\xa0", '.' => ',' ];
$separatorTransformTable = [ ',' => "\u{00A0}", '.' => ',' ];

View file

@ -275,7 +275,7 @@ $magicWords = [
'url_query' => [ '0', 'INFORMPETO', 'QUERY' ],
];
$separatorTransformTable = [ ',' => "\xc2\xa0", '.' => ',' ];
$separatorTransformTable = [ ',' => "\u{00A0}", '.' => ',' ];
$datePreferences = false;
$defaultDateFormat = 'dmy';

View file

@ -302,7 +302,7 @@ $dateFormats = [
'dmy both' => 'H:i j M Y',
];
$separatorTransformTable = [ ',' => "\xc2\xa0", '.' => ',' ];
$separatorTransformTable = [ ',' => "\u{00A0}", '.' => ',' ];
$minimumGroupingDigits = 2;
$linkTrail = '/^([a-záéíóúñ]+)(.*)$/sDu';

View file

@ -258,7 +258,7 @@ $magicWords = [
'formatdate' => [ '0', 'kuupäevavormindus', 'formatdate', 'dateformat' ],
];
$separatorTransformTable = [ ',' => "\xc2\xa0", '.' => ',' ];
$separatorTransformTable = [ ',' => "\u{00A0}", '.' => ',' ];
$minimumGroupingDigits = 2;
$linkTrail = '/^([äöõšüža-z]+)(.*)$/sDu';

View file

@ -245,7 +245,7 @@ $magicWords = [
'protectionlevel' => [ '1', 'SUOJAUSTASO', 'PROTECTIONLEVEL' ],
];
$separatorTransformTable = [ ',' => "\xc2\xa0", '.' => ',' ];
$separatorTransformTable = [ ',' => "\u{00A0}", '.' => ',' ];
$datePreferences = [
'default',

View file

@ -316,4 +316,4 @@ $dateFormats = [
'ymd both' => 'Y F j à H:i',
];
$separatorTransformTable = [ ',' => "\xc2\xa0", '.' => ',' ];
$separatorTransformTable = [ ',' => "\u{00A0}", '.' => ',' ];

View file

@ -301,4 +301,4 @@ $dateFormats = [
'ymd both' => 'Y F j "a" H:i',
];
$separatorTransformTable = [ ',' => "\xc2\xa0", '.' => ',' ];
$separatorTransformTable = [ ',' => "\u{00A0}", '.' => ',' ];

View file

@ -104,4 +104,4 @@ $dateFormats = [
'dmy both' => 'j "di" M Y "a lis" H:i',
];
$separatorTransformTable = [ ',' => "\xc2\xa0", '.' => ',' ];
$separatorTransformTable = [ ',' => "\u{00A0}", '.' => ',' ];

View file

@ -40,7 +40,7 @@ $namespaceAliases = [
];
$fallback8bitEncoding = "iso8859-2";
$separatorTransformTable = [ ',' => "\xc2\xa0", '.' => ',' ];
$separatorTransformTable = [ ',' => "\u{00A0}", '.' => ',' ];
$specialPageAliases = [
'Activeusers' => [ 'Aktív_felhasználók', 'Aktív_szerkesztők' ],

View file

@ -9,7 +9,7 @@
*/
$separatorTransformTable = [
',' => "\xc2\xa0", # nbsp
',' => "\u{00A0}", # nbsp
'.' => ','
];
$minimumGroupingDigits = 2;

View file

@ -8,7 +8,7 @@
*
*/
$separatorTransformTable = [ ',' => "\xc2\xa0", '.' => ',' ];
$separatorTransformTable = [ ',' => "\u{00A0}", '.' => ',' ];
$namespaceNames = [
NS_MEDIA => 'Multimedia',

View file

@ -32,7 +32,7 @@ $namespaceAliases = [
'Discussioni_immagine' => NS_FILE_TALK,
];
$separatorTransformTable = [ ',' => "\xc2\xa0", '.' => ',' ];
$separatorTransformTable = [ ',' => "\u{00A0}", '.' => ',' ];
$dateFormats = [
'mdy time' => 'H:i',

View file

@ -11,7 +11,7 @@
$fallback = 'kk-latn, kk-cyrl';
$separatorTransformTable = [
',' => "\xc2\xa0",
',' => "\u{00A0}",
'.' => ',',
];
$minimumGroupingDigits = 2;

View file

@ -19,7 +19,7 @@
*/
$separatorTransformTable = [
',' => "\xc2\xa0",
',' => "\u{00A0}",
'.' => ',',
];
$minimumGroupingDigits = 2;

View file

@ -15,7 +15,7 @@
$fallback = 'kk-cyrl';
$separatorTransformTable = [
',' => "\xc2\xa0",
',' => "\u{00A0}",
'.' => ',',
];

View file

@ -94,7 +94,7 @@ $namespaceAliases = [
'Katejorije_Klaaf' => NS_CATEGORY_TALK,
];
$separatorTransformTable = [ ',' => "\xc2\xa0", '.' => ',' ];
$separatorTransformTable = [ ',' => "\u{00A0}", '.' => ',' ];
$minimumGroupingDigits = 2;
$linkTrail = '/^([äöüėëijßəğåůæœça-z]+)(.*)$/sDu';

View file

@ -51,7 +51,7 @@ $namespaceAliases = [
'Disputatio_Imaginis' => NS_FILE_TALK,
];
$separatorTransformTable = [ ',' => "\xc2\xa0" ];
$separatorTransformTable = [ ',' => "\u{00A0}" ];
$dateFormats = [
'mdy time' => 'H:i',

View file

@ -12,7 +12,7 @@
$fallback = 'ru';
$separatorTransformTable = [
',' => "\xc2\xa0", # nbsp
',' => "\u{00A0}", # nbsp
'.' => ','
];

View file

@ -19,4 +19,4 @@ $namespaceGenderAliases = [];
$linkPrefixExtension = true;
# Same as the French (T10485)
$separatorTransformTable = [ ',' => "\xc2\xa0", '.' => ',' ];
$separatorTransformTable = [ ',' => "\u{00A0}", '.' => ',' ];

View file

@ -171,7 +171,7 @@ $magicWords = [
];
$fallback8bitEncoding = 'windows-1257';
$separatorTransformTable = [ ',' => "\xc2\xa0", '.' => ',' ];
$separatorTransformTable = [ ',' => "\u{00A0}", '.' => ',' ];
$dateFormats = [
'ymd time' => 'H:i',

View file

@ -63,7 +63,7 @@ $namespaceGenderAliases = [
NS_USER_TALK => [ 'male' => 'Dalībnieka_diskusija', 'female' => 'Dalībnieces_diskusija' ]
];
$separatorTransformTable = [ ',' => "\xc2\xa0", '.' => ',' ];
$separatorTransformTable = [ ',' => "\u{00A0}", '.' => ',' ];
/**
* A list of date format preference keys, which can be selected in user

View file

@ -323,6 +323,6 @@ $digitTransformTable = [
'9' => '९', # &#x096f;
];
$linkTrail = "/^([\xE0\xA4\x80-\xE0\xA5\xA3\xE0\xA5\xB1-\xE0\xA5\xBF\xEF\xBB\xBF\xE2\x80\x8D]+)(.*)$/sDu";
$linkTrail = "/^([\u{0900}-\u{0963}\u{0971}-\u{097F}\u{FEFF}\u{200D}]+)(.*)$/sDu";
$digitGroupingPattern = "##,##,###";

View file

@ -82,7 +82,7 @@ $namespaceAliases = [
'Bildediskusjon' => NS_FILE_TALK,
];
$separatorTransformTable = [ ',' => "\xc2\xa0", '.' => ',' ];
$separatorTransformTable = [ ',' => "\u{00A0}", '.' => ',' ];
$linkTrail = '/^([æøåa-z]+)(.*)$/sDu';
$datePreferenceMigrationMap = [

View file

@ -317,7 +317,7 @@ $specialPageAliases = [
];
$separatorTransformTable = [
',' => "\xc2\xa0",
',' => "\u{00A0}",
'.' => ','
];
$linkTrail = '/^([æøåa-z]+)(.*)$/sDu';

View file

@ -286,6 +286,6 @@ $dateFormats = [
'oc normal both' => 'j F "de" Y "a" H.i',
];
$separatorTransformTable = [ ',' => "\xc2\xa0", '.' => ',' ];
$separatorTransformTable = [ ',' => "\u{00A0}", '.' => ',' ];
$linkTrail = "/^([a-zàâçéèêîôû]+)(.*)$/sDu";

View file

@ -121,7 +121,7 @@ $dateFormats = [
$fallback8bitEncoding = 'iso-8859-2';
$separatorTransformTable = [
',' => "\xc2\xa0", // T4749
',' => "\u{00A0}", // T4749
'.' => ','
];
$minimumGroupingDigits = 2;

View file

@ -110,7 +110,7 @@ $dateFormats = [
'dmy both' => 'H\hi\m\i\n \d\e j \d\e F \d\e Y',
];
$separatorTransformTable = [ ',' => "\xc2\xa0", '.' => ',' ];
$separatorTransformTable = [ ',' => "\u{00A0}", '.' => ',' ];
$linkTrail = '/^([áâãàéêẽçíòóôõq̃úüűũa-z]+)(.*)$/sDu'; # T23168, T29633
$specialPageAliases = [

View file

@ -120,7 +120,7 @@ $dateFormats = [
];
$separatorTransformTable = [ ',' => "\xc2\xa0", '.' => ',' ];
$separatorTransformTable = [ ',' => "\u{00A0}", '.' => ',' ];
$specialPageAliases = [
'Activeusers' => [ 'Usuários_ativos' ],

View file

@ -417,7 +417,7 @@ $bookstoreList = [
];
$separatorTransformTable = [
',' => "\xc2\xa0", # nbsp
',' => "\u{00A0}", # nbsp
'.' => ','
];
$minimumGroupingDigits = 2;

View file

@ -134,6 +134,6 @@ $magicWords = [
'img_link' => [ '1', 'liŋka=$1', 'link=$1' ],
];
$separatorTransformTable = [ ',' => "\xc2\xa0", '.' => ',' ];
$separatorTransformTable = [ ',' => "\u{00A0}", '.' => ',' ];
$linkTrail = '/^(:?[a-zàáâçčʒǯđðéèêëǧǥȟíìîïıǩŋñóòôõßšŧúùûýÿüžþæøåäö]+)(.*)$/sDu';

View file

@ -285,7 +285,7 @@ $namespaceGenderAliases = [
];
$separatorTransformTable = [
',' => "\xc2\xa0",
',' => "\u{00A0}",
'.' => ','
];

View file

@ -321,7 +321,7 @@ $magicWords = [
$linkTrail = '/^([a-zåäöéÅÄÖÉ]+)(.*)$/sDu';
$separatorTransformTable = [
',' => "\xc2\xa0", // T4749
',' => "\u{00A0}", // T4749
'.' => ','
];

View file

@ -80,6 +80,6 @@ $magicWords = [
'url_wiki' => [ '0', 'விக்கி', 'WIKI' ],
];
$linkTrail = "/^([\xE0\xAE\x80-\xE0\xAF\xBF]+)(.*)$/sDu";
$linkTrail = "/^([\u{0B80}-\u{0BFF}]+)(.*)$/sDu";
$digitGroupingPattern = "##,##,###";

View file

@ -144,6 +144,6 @@ $magicWords = [
'special' => [ '0', 'ప్రత్యేక', 'special' ],
];
$linkTrail = "/^([\xE0\xB0\x81-\xE0\xB1\xAF]+)(.*)$/sDu";
$linkTrail = "/^([\u{0C01}-\u{0C6F}]+)(.*)$/sDu";
$digitGroupingPattern = "##,##,###";

View file

@ -44,4 +44,4 @@ $namespaceGenderAliases = [];
$linkTrail = '/^([a-zа-яёӝӟӥӧӵ]+)(.*)$/sDu';
$fallback8bitEncoding = 'windows-1251';
$separatorTransformTable = [ ',' => "\xc2\xa0", '.' => ',' ];
$separatorTransformTable = [ ',' => "\u{00A0}", '.' => ',' ];

View file

@ -55,7 +55,7 @@
*/
$separatorTransformTable = [
',' => "\xc2\xa0", # nbsp
',' => "\u{00A0}", # nbsp
'.' => ','
];
$minimumGroupingDigits = 2;

View file

@ -121,5 +121,5 @@ $dateFormats = [
*/
$separatorTransformTable = [
'.' => ',',
',' => "\xc2\xa0", # nbsp
',' => "\u{00A0}", # nbsp
];

View file

@ -79,7 +79,7 @@ $specialPageAliases = [
# definixha del cogne po les limeros
# (number format definition)
# en: 12,345.67 -> wa: 12 345,67
$separatorTransformTable = [ ',' => "\xc2\xa0", '.' => ',' ];
$separatorTransformTable = [ ',' => "\u{00A0}", '.' => ',' ];
# $linkTrail = '/^([a-zåâêîôûçéèA-ZÅÂÊÎÔÛÇÉÈ]+)(.*)$/sDu';
$linkTrail = '/^([a-zåâêîôûçéè]+)(.*)$/sDu';

View file

@ -539,7 +539,7 @@ class GenerateSitemap extends Maintenance {
*/
function generateLimit( $namespace ) {
// T19961: make a title with the longest possible URL in this namespace
$title = Title::makeTitle( $namespace, str_repeat( "\xf0\xa8\xae\x81", 63 ) . "\xe5\x96\x83" );
$title = Title::makeTitle( $namespace, str_repeat( "\u{28B81}", 63 ) . "\u{5583}" );
$this->limit = [
strlen( $this->openFile() ),

View file

@ -508,18 +508,18 @@ class Languages {
$this->loadGeneralMessages();
$this->loadMessages( $code );
$wrongChars = [
'[LRM]' => "\xE2\x80\x8E",
'[RLM]' => "\xE2\x80\x8F",
'[LRE]' => "\xE2\x80\xAA",
'[RLE]' => "\xE2\x80\xAB",
'[POP]' => "\xE2\x80\xAC",
'[LRO]' => "\xE2\x80\xAD",
'[RLO]' => "\xE2\x80\xAB",
'[ZWSP]' => "\xE2\x80\x8B",
'[NBSP]' => "\xC2\xA0",
'[WJ]' => "\xE2\x81\xA0",
'[BOM]' => "\xEF\xBB\xBF",
'[FFFD]' => "\xEF\xBF\xBD",
'[LRM]' => "\u{200E}",
'[RLM]' => "\u{200F}",
'[LRE]' => "\u{202A}",
'[RLE]' => "\u{202B}",
'[POP]' => "\u{202C}",
'[LRO]' => "\u{202D}",
'[RLO]' => "\u{202B}",
'[ZWSP]' => "\u{200B}",
'[NBSP]' => "\u{00A0}",
'[WJ]' => "\u{2060}",
'[BOM]' => "\u{FEFF}",
'[FFFD]' => "\u{FFFD}",
];
$wrongRegExp = '/(' . implode( '|', array_values( $wrongChars ) ) . ')/sDu';
$wrongCharsMessages = [];

View file

@ -53,11 +53,11 @@ class CustomUppercaseCollationTest extends MediaWikiTestCase {
[ 'do', 'D' ],
[ 'Ao', 'A' ],
[ 'afdsa', 'A' ],
[ "\xF3\xB3\x80\x80Foo", 'D' ],
[ "\xF3\xB3\x80\x81Foo", 'C' ],
[ "\xF3\xB3\x80\x82Foo", 'Cs' ],
[ "\xF3\xB3\x80\x83Foo", 'B' ],
[ "\xF3\xB3\x80\x84Foo", "\xF3\xB3\x80\x84" ],
[ "\u{F3000}Foo", 'D' ],
[ "\u{F3001}Foo", 'C' ],
[ "\u{F3002}Foo", 'Cs' ],
[ "\u{F3003}Foo", 'B' ],
[ "\u{F3004}Foo", "\u{F3004}" ],
[ 'C', 'C' ],
[ 'Cz', 'C' ],
[ 'Cs', 'Cs' ],

View file

@ -35,7 +35,7 @@ class CSSMinTest extends MediaWikiTestCase {
public static function provideSerializeStringValue() {
return [
[ 'Hello World!', '"Hello World!"' ],
[ "Null\0Null", "\"Null\xEF\xBF\xBDNull\"" ],
[ "Null\0Null", "\"Null\u{FFFD}Null\"" ],
[ '"', '"\\""' ],
[ "'", '"\'"' ],
[ "\\", '"\\\\"' ],
@ -43,9 +43,9 @@ class CSSMinTest extends MediaWikiTestCase {
[ "Space tab \t space", '"Space tab \\9 space"' ],
[ "Line\nfeed", '"Line\\a feed"' ],
[ "Return\rreturn", '"Return\\d return"' ],
[ "Next\xc2\x85line", "\"Next\xc2\x85line\"" ],
[ "Next\u{0085}line", "\"Next\u{0085}line\"" ],
[ "Del\x7fDel", '"Del\\7f Del"' ],
[ "nb\xc2\xa0sp", "\"nb\xc2\xa0sp\"" ],
[ "nb\u{00A0}sp", "\"nb\u{00A0}sp\"" ],
[ "AMP&amp;AMP", "\"AMP&amp;AMP\"" ],
[ '!"#$%&\'()*+,-./0123456789:;<=>?', '"!\\"#$%&\'()*+,-./0123456789:;<=>?"' ],
[ '@[\\]^_`{|}~', '"@[\\\\]^_`{|}~"' ],

View file

@ -1593,9 +1593,9 @@ class LanguageTest extends LanguageClassesTestCase {
* @covers Language::embedBidi()
*/
public function testEmbedBidi() {
$lre = "\xE2\x80\xAA"; // U+202A LEFT-TO-RIGHT EMBEDDING
$rle = "\xE2\x80\xAB"; // U+202B RIGHT-TO-LEFT EMBEDDING
$pdf = "\xE2\x80\xAC"; // U+202C POP DIRECTIONAL FORMATTING
$lre = "\u{202A}"; // U+202A LEFT-TO-RIGHT EMBEDDING
$rle = "\u{202B}"; // U+202B RIGHT-TO-LEFT EMBEDDING
$pdf = "\u{202C}"; // U+202C POP DIRECTIONAL FORMATTING
$lang = $this->getLang();
$this->assertEquals(
'123',