Documentation

utf8 extends Utf8
in package

FinalYes

UTF-8 helper class.

Table of Contents

Methods

clean()  : T
Recursively cleans arrays, objects, and strings. Removes ASCII control codes and converts to UTF-8 while silently discarding incompatible UTF-8 characters.
isAscii()  : bool
Tests whether a string contains only 7bit ASCII bytes.
setup()  : void
Normalizes global input variables to the UTF-8 charset.
stripAsciiCtrl()  : string
Strips out device control codes in the ASCII range.
stripNonAscii()  : string
Strips out all non-7bit ASCII bytes.

Methods

clean()

Recursively cleans arrays, objects, and strings. Removes ASCII control codes and converts to UTF-8 while silently discarding incompatible UTF-8 characters.

public static clean(T $value) : T
Parameters
$value : T

Thing to clean

Tags
template

extends string|array|object

Return values
T

isAscii()

Tests whether a string contains only 7bit ASCII bytes.

public static isAscii(string $str) : bool
Parameters
$str : string

string to check

Return values
bool

setup()

Normalizes global input variables to the UTF-8 charset.

public static setup() : void
  • GET
  • POST
  • COOKIE
  • SERVER
Tags
throws
Exception

stripAsciiCtrl()

Strips out device control codes in the ASCII range.

public static stripAsciiCtrl(string $str) : string
Parameters
$str : string

string to clean

Return values
string

stripNonAscii()

Strips out all non-7bit ASCII bytes.

public static stripNonAscii(string $str) : string
Parameters
$str : string

string to clean

Return values
string
On this page

Search results