Internationalization Normalizer::getRawDecomposition

Normalizer::getRawDecomposition

normalizer_get_raw_decomposition

(PHP 7 >= 7.3, PHP 8)

Normalizer::getRawDecomposition -- normalizer_get_raw_decomposition — 지정된 UTF-8로 인코딩된 코드 포인트에 대한 Decomposition_Mapping 속성을 가져옵니다.


설명

객체 지향 스타일

public static Normalizer::getRawDecomposition(string $string, int $form = Normalizer::FORM_C): ?string

절차적 스타일

normalizer_get_raw_decomposition(string $string, int $form = Normalizer::FORM_C): ?string

지정된 UTF-8로 인코딩된 코드 포인트에 대해 UCD(유니코드 문자 데이터베이스)에 지정된 대로 Decomposition_Mapping 속성을 가져옵니다.


매개변수

string
입력 문자열은 UTF-8로 인코딩된 단일 코드 포인트여야 합니다.

반환 값

UCD에 있는 경우 Decomposition_Mapping 속성이 포함된 문자열을 반환합니다.

캐릭터에 대한 Decomposition_Mapping 속성이 없으면 null을 반환합니다.


Examples

예제 #1 Normalizer::getRawDecomposition() 예제

                  
<?php

$result = "";
$strings = [
    "a",
    "\u{FFDA}",
    "\u{FDFA}",
    "",
    "aa",
    "\xF5",
];

foreach ($strings as $string) {
    $decomposition = Normalizer::getRawDecomposition($string);
    // $decomposition = normalizer_get_raw_decomposition($string); Procedural way

    $error_code = intl_get_error_code();
    $error_message = intl_get_error_message();

    $string_hex = bin2hex($string);
    $result .= "---------------------\n";

    if ($decomposition === null) {
        $result .= "'$string_hex' has no decomposition mapping\n" ;
    } else {
        $result .= "'$string_hex' has the decomposition mapping '" . bin2hex($decomposition) . "'\n" ;
    }

    $result .= "error info: '$error_message' ($error_code)\n";
}

echo $result;
?>
                  
                

위의 예는 다음을 출력합니다.

---------------------
'61' has no decomposition mapping
error info: 'U_ZERO_ERROR' (0)
---------------------
'efbf9a' has the decomposition mapping 'e385a1'
error info: 'U_ZERO_ERROR' (0)
---------------------
'efb7ba' has the decomposition mapping 'd8b5d984d98920d8a7d984d984d98720d8b9d984d98ad98720d988d8b3d984d985'
error info: 'U_ZERO_ERROR' (0)
---------------------
'' has no decomposition mapping
error info: 'Input string must be exactly one UTF-8 encoded code point long.: U_ILLEGAL_ARGUMENT_ERROR' (1)
---------------------
'6161' has no decomposition mapping
error info: 'Input string must be exactly one UTF-8 encoded code point long.: U_ILLEGAL_ARGUMENT_ERROR' (1)
---------------------
'f5' has no decomposition mapping
error info: 'Code point out of range: U_ILLEGAL_ARGUMENT_ERROR' (1)
                

기타