Utf8
in package
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
Return values
TisAscii()
Tests whether a string contains only 7bit ASCII bytes.
public
static isAscii(string $str) : bool
Parameters
- $str : string
-
string to check
Return values
boolsetup()
Normalizes global input variables to the UTF-8 charset.
public
static setup() : void
- GET
- POST
- COOKIE
- SERVER
Tags
stripAsciiCtrl()
Strips out device control codes in the ASCII range.
public
static stripAsciiCtrl(string $str) : string
Parameters
- $str : string
-
string to clean
Return values
stringstripNonAscii()
Strips out all non-7bit ASCII bytes.
public
static stripNonAscii(string $str) : string
Parameters
- $str : string
-
string to clean