function Utils::surrogatePairToUtf8
Converts a surrogate pair of Unicode code points to UTF-8
@codeCoverageIgnore
Parameters
string $first First Unicode code point:
string $second Second Unicode code point:
Return value
string
1 call to Utils::surrogatePairToUtf8()
- Utils::unquoteLiteralString in vendor/
mck89/ peast/ lib/ Peast/ Syntax/ Utils.php - This function takes a string as it appears in the source code and returns an unquoted version of it
File
-
vendor/
mck89/ peast/ lib/ Peast/ Syntax/ Utils.php, line 114
Class
- Utils
- Utilities class.
Namespace
Peast\SyntaxCode
public static function surrogatePairToUtf8($first, $second) {
//From: https://stackoverflow.com/questions/39226593/how-to-convert-utf16-surrogate-pairs-to-equivalent-hex-codepoint-in-php
$value = (hexdec($first) & 0x3ff) << 10 | hexdec($second) & 0x3ff;
return self::unicodeToUtf8($value + 0x10000);
}