IDN Converter - PHP Library

UnicodeConverter
in package
implements ConversionInterface

Interfaces, Classes, Traits and Enums

ConversionInterface

Table of Contents

check()  : bool
Check if the keyword is in Unicode format.
containsUnicodeCharacters()  : bool
Check if a string contains Unicode characters represented by escape sequences.
convert()  : string
Convert the keyword to Unicode format.
decode()  : string
Convert Unicode escape sequences to their corresponding characters.

Methods

check()

Check if the keyword is in Unicode format.

public static check(string $keyword) : bool
Parameters
$keyword : string

The keyword to check

Return values
bool

True if the keyword is in IDN format, false otherwise

containsUnicodeCharacters()

Check if a string contains Unicode characters represented by escape sequences.

public static containsUnicodeCharacters(string $str) : bool

Unicode characters can be represented in PHP strings using escape sequences like \uXXXX. This function checks if the input string contains any Unicode characters.

Parameters
$str : string

The input string to check.

Return values
bool

Returns true if the string contains Unicode characters, false otherwise.

convert()

Convert the keyword to Unicode format.

public static convert(string $keyword, mixed $options) : string
Parameters
$keyword : string

The keyword to convert

$options : mixed
Return values
string

Returns the IDN representation of the keyword

decode()

Convert Unicode escape sequences to their corresponding characters.

public static decode(string $unicodeString) : string
Parameters
$unicodeString : string

String with Unicode escape sequences

Return values
string

Converted string with actual Unicode characters

Search results