Skip to main content
Drupal API
User account menu
  • Log in

Breadcrumb

  1. Drupal Core 11.1.x
  2. Utils.php

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\Syntax

Code

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);
}

API Navigation

  • Drupal Core 11.1.x
  • Topics
  • Classes
  • Functions
  • Constants
  • Globals
  • Files
  • Namespaces
  • Deprecated
  • Services
RSS feed
Powered by Drupal