PHP Class CI_Utf8, TastyIgniter

Provides support for UTF-8 environments
Author: EllisLab Dev Team
Show file Open project: tastyigniter/tastyigniter Class Usage Examples

Public Methods

Method Description
__construct ( ) : void Class constructor
clean_string ( string $str ) : string Clean UTF-8 strings
convert_to_utf8 ( string $str, string $encoding ) : string Convert to UTF-8
is_ascii ( string $str ) : boolean Is ASCII?
safe_ascii_for_xml ( string $str ) : string Remove ASCII control characters

Method Details

__construct() public method

Determines if UTF-8 support is to be enabled.
public __construct ( ) : void
return void

clean_string() public method

Ensures strings contain only valid UTF-8 characters.
public clean_string ( string $str ) : string
$str string String to clean
return string

convert_to_utf8() public method

Attempts to convert a string to UTF-8.
public convert_to_utf8 ( string $str, string $encoding ) : string
$str string Input string
$encoding string Input encoding
return string $str encoded in UTF-8 or FALSE on failure

is_ascii() public method

Tests if a string is standard 7-bit ASCII or not.
public is_ascii ( string $str ) : boolean
$str string String to check
return boolean

safe_ascii_for_xml() public method

Removes all ASCII control characters except horizontal tabs, line feeds, and carriage returns, as all others can cause problems in XML.
public safe_ascii_for_xml ( string $str ) : string
$str string String to clean
return string