Converts data to UTF-8.
Requires the iconv, GNU recode or mbstring PHP extension.
Parameters
string $data: The data to be converted.
string $encoding: The encoding that the data is in.
Return value
string|bool Converted data or FALSE.
4 calls to advagg_convert_to_utf8()
- advagg_file_get_contents in ./
advagg.module - Same as file_get_contents() but will convert string to UTF-8 if needed.
- advagg_load_stylesheet_content in ./
advagg.module - Processes the contents of a stylesheet for aggregation.
- advagg_pre_render_scripts in ./
advagg.module - Callback for pre_render to add elements needed for JavaScript to be rendered.
- advagg_relocate_process_http_request in advagg_relocate/
advagg_relocate.advagg.inc - Get the TTL and fix UTF-8 encoding.
File
-
./
advagg.module, line 5193
Code
function advagg_convert_to_utf8($data, $encoding) {
if (function_exists('iconv')) {
return @iconv($encoding, 'utf-8', $data);
}
elseif (function_exists('mb_convert_encoding')) {
return @mb_convert_encoding($data, 'utf-8', $encoding);
}
elseif (function_exists('recode_string')) {
// phpcs:ignore
return @recode_string($encoding . '..utf-8', $data);
}
// Cannot convert.
return FALSE;
}