function PhpTransliteration::readGenericData
Same name in other branches
- 9 core/lib/Drupal/Component/Transliteration/PhpTransliteration.php \Drupal\Component\Transliteration\PhpTransliteration::readGenericData()
- 10 core/lib/Drupal/Component/Transliteration/PhpTransliteration.php \Drupal\Component\Transliteration\PhpTransliteration::readGenericData()
- 11.x core/lib/Drupal/Component/Transliteration/PhpTransliteration.php \Drupal\Component\Transliteration\PhpTransliteration::readGenericData()
Reads in generic transliteration data for a bank of characters.
The data is read in from a file named "x$bank.php" (with $bank in hexadecimal notation) in PhpTransliteration::$dataDirectory. These files should set up a variable $bank containing an array whose numerical indices are the remaining two bytes of the character code, and whose values are the transliterations of these characters into US-ASCII. Note that the maximum Unicode character that can be encoded in this way is 4 bytes.
Parameters
$bank: First two bytes of the Unicode character, or 0 for the ASCII range.
1 call to PhpTransliteration::readGenericData()
- PhpTransliteration::lookupReplacement in core/
lib/ Drupal/ Component/ Transliteration/ PhpTransliteration.php - Look up the generic replacement for a UTF-8 character code.
File
-
core/
lib/ Drupal/ Component/ Transliteration/ PhpTransliteration.php, line 308
Class
- PhpTransliteration
- Implements transliteration without using the PECL extensions.
Namespace
Drupal\Component\TransliterationCode
protected function readGenericData($bank) {
// Figure out the file name.
$file = $this->dataDirectory . '/x' . sprintf('%02x', $bank) . '.php';
// Read in this file, which should set up a variable called $base, which
// will be local to this function.
if (is_file($file)) {
include $file;
}
if (!isset($base) || !is_array($base)) {
$base = [];
}
// Save this data.
$this->genericMap[$bank] = $base;
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.