\Horde_String_Transliterate

Provides utility methods used to transliterate a string.

Summary

Methods
Properties
Constants
toAscii()
No public properties found
No constants found
_intlToAscii()
_iconvToAscii()
_fallbackToAscii()
$_map
$_transliterator
N/A
No private methods found
No private properties found
N/A

Properties

$_map

$_map : array

Transliterate mapping cache.

Type

array

$_transliterator

$_transliterator : \Transliterator

Transliterator instance.

Type

\Transliterator

Methods

toAscii()

toAscii(string  $str) : string

Transliterates an UTF-8 string to ASCII, replacing non-English characters to their English equivalents.

Note: there is no guarantee that the output string will be ASCII-only, since any non-ASCII character not in the transliteration list will be ignored.

Parameters

string $str

Input string (UTF-8).

Returns

string —

Transliterated string (UTF-8).

_intlToAscii()

_intlToAscii(string  $str) : mixed

Transliterate using the Transliterator package.

Parameters

string $str

Input string (UTF-8).

Returns

mixed —

Transliterated string (UTF-8), or false on error.

_iconvToAscii()

_iconvToAscii(string  $str) : mixed

Transliterate using the iconv extension.

Parameters

string $str

Input string (UTF-8).

Returns

mixed —

Transliterated string (UTF-8), or false on error.

_fallbackToAscii()

_fallbackToAscii(string  $str) : string

Transliterate using a built-in ASCII mapping.

Parameters

string $str

Input string (UTF-8).

Returns

string —

Transliterated string (UTF-8).