* @param string $string The input xml-formatted text.
* @param string $default_encoding This is the default encoding to be returned if there is no way the xml-text's encoding to be detected. If it not spesified, the system encoding is assumed then.
* @param string $default_encoding This is the default encoding to be returned
* if there is no way the xml-text's encoding to be detected. If it not spesified, the system encoding is assumed then.
* @return string Returns the detected encoding.
* @todo The second parameter is to be eliminated. See api_detect_encoding_html().
*/
@ -125,10 +142,12 @@ function api_detect_encoding_xml($string, $default_encoding = null)
/**
* Converts character encoding of a xml-formatted text. If inside the text the encoding is declared, it is modified accordingly.
* Converts character encoding of a xml-formatted text.
* If inside the text the encoding is declared, it is modified accordingly.
* @param string $string The text being converted.
* @param string $to_encoding The encoding that text is being converted to.
* @param string $from_encoding (optional) The encoding that text is being converted from. If it is omited, it is tried to be detected then.
* @param string $from_encoding (optional) The encoding that text is being converted from.
* If it is omited, it is tried to be detected then.
* @return string Returns the converted xml-text.
*/
function api_convert_encoding_xml($string, $to_encoding, $from_encoding = null)
@ -137,9 +156,11 @@ function api_convert_encoding_xml($string, $to_encoding, $from_encoding = null)
}
/**
* Converts character encoding of a xml-formatted text into UTF-8. If inside the text the encoding is declared, it is set to UTF-8.
* Converts character encoding of a xml-formatted text into UTF-8.
* If inside the text the encoding is declared, it is set to UTF-8.
* @param string $string The text being converted.
* @param string $from_encoding (optional) The encoding that text is being converted from. If it is omited, it is tried to be detected then.
* @param string $from_encoding (optional) The encoding that text is being converted from.
* If it is omited, it is tried to be detected then.
* @return string Returns the converted xml-text.
*/
function api_utf8_encode_xml($string, $from_encoding = null)
@ -148,9 +169,11 @@ function api_utf8_encode_xml($string, $from_encoding = null)
}
/**
* Converts character encoding of a xml-formatted text from UTF-8 into a specified encoding. If inside the text the encoding is declared, it is modified accordingly.
* Converts character encoding of a xml-formatted text from UTF-8 into a specified encoding.
* If inside the text the encoding is declared, it is modified accordingly.
* @param string $string The text being converted.
* @param string $to_encoding (optional) The encoding that text is being converted to. If it is omited, the platform character set is assumed.
* @param string $to_encoding (optional) The encoding that text is being converted to.
* If it is omitted, the platform character set is assumed.
* @return string Returns the converted xml-text.
*/
function api_utf8_decode_xml($string, $to_encoding = 'UTF-8')
@ -159,10 +182,12 @@ function api_utf8_decode_xml($string, $to_encoding = 'UTF-8')
}
/**
* Converts character encoding of a xml-formatted text. If inside the text the encoding is declared, it is modified accordingly.
* Converts character encoding of a xml-formatted text.
* If inside the text the encoding is declared, it is modified accordingly.
* @param string $string The text being converted.
* @param string $to_encoding The encoding that text is being converted to.
* @param string $from_encoding (optional) The encoding that text is being converted from. If the value is empty, it is tried to be detected then.
* @param string $from_encoding (optional) The encoding that text is being converted from.
* If the value is empty, it is tried to be detected then.
* @return string Returns the converted xml-text.
*/
function _api_convert_encoding_xml(&$string, $to_encoding, $from_encoding)
@ -172,11 +197,16 @@ function _api_convert_encoding_xml(&$string, $to_encoding, $from_encoding)