Documentation

Horde_String_Transliterate
in package

Provides utility methods used to transliterate a string.

Tags
author

Michael Slusarz slusarz@horde.org

author

Jan Schneider jan@horde.org

category

Horde

copyright

2014-2017 Horde LLC

license

http://www.horde.org/licenses/lgpl21 LGPL 2.1

since
2.4.0

Table of Contents

$_map  : array<string|int, mixed>
Transliterate mapping cache.
$_transliterator  : Transliterator
Transliterator instance.
toAscii()  : string
Transliterates an UTF-8 string to ASCII, replacing non-English characters to their English equivalents.
_fallbackToAscii()  : string
Transliterate using a built-in ASCII mapping.
_iconvToAscii()  : mixed
Transliterate using the iconv extension.
_intlToAscii()  : mixed
Transliterate using the Transliterator package.

Properties

$_map

Transliterate mapping cache.

protected static array<string|int, mixed> $_map

$_transliterator

Transliterator instance.

protected static Transliterator $_transliterator

Methods

toAscii()

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

public static toAscii(string $str) : string

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
$str : string

Input string (UTF-8).

Return values
string

Transliterated string (UTF-8).

_fallbackToAscii()

Transliterate using a built-in ASCII mapping.

protected static _fallbackToAscii(string $str) : string
Parameters
$str : string

Input string (UTF-8).

Return values
string

Transliterated string (UTF-8).

_iconvToAscii()

Transliterate using the iconv extension.

protected static _iconvToAscii(string $str) : mixed
Parameters
$str : string

Input string (UTF-8).

Return values
mixed

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

_intlToAscii()

Transliterate using the Transliterator package.

protected static _intlToAscii(string $str) : mixed
Parameters
$str : string

Input string (UTF-8).

Return values
mixed

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

Search results