\CI_Utf8

Utf8 Class

Provides support for UTF-8 environments

Summary

Methods
Properties
Constants
__construct()
clean_string()
safe_ascii_for_xml()
convert_to_utf8()
is_ascii()
No public properties found
No constants found
No protected methods found
No protected properties found
N/A
No private methods found
No private properties found
N/A

Methods

__construct()

__construct(  $charset) : void

Class constructor

Determines if UTF-8 support is to be enabled.

Parameters

$charset

clean_string()

clean_string(string  $str) : string

Clean UTF-8 strings

Ensures strings contain only valid UTF-8 characters.

Parameters

string $str

String to clean

Returns

string

safe_ascii_for_xml()

safe_ascii_for_xml(string  $str) : string

Remove ASCII control characters

Removes all ASCII control characters except horizontal tabs, line feeds, and carriage returns, as all others can cause problems in XML.

Parameters

string $str

String to clean

Returns

string

convert_to_utf8()

convert_to_utf8(string  $str, string  $encoding) : string

Convert to UTF-8

Attempts to convert a string to UTF-8.

Parameters

string $str

Input string

string $encoding

Input encoding

Returns

string —

$str encoded in UTF-8 or FALSE on failure

is_ascii()

is_ascii(string  $str) : boolean

Is ASCII?

Tests if a string is standard 7-bit ASCII or not.

Parameters

string $str

String to check

Returns

boolean