API16:JString/transcode
From Joomla! Documentation
This Namespace has been archived - Please Do Not Edit or Create Pages in this namespace. Pages contain information for a Joomla! version which is no longer supported. It exists only as a historical reference, will not be improved and its content may be incomplete.
Contents |
Description
Transcode a string.
Syntax
static transcode($source, $from_encoding, $to_encoding)
| Parameter Name | Default Value | Description |
|---|---|---|
| $source | $source The string to transcode. | |
| $from_encoding | $from_encoding The source encoding. | |
| $to_encoding | $to_encoding The target encoding. |
Returns
string Transcoded string
Defined in
libraries/joomla/utilities/string.php
Importing
jimport( 'joomla.utilities.string' );
Source Body
public static function transcode($source, $from_encoding, $to_encoding) { if (is_string($source)) { /* * "//TRANSLIT" is appendd to the $to_encoding to ensure that when iconv comes * across a character that cannot be represented in the target charset, it can * be approximated through one or several similarly looking characters. */ return iconv($from_encoding, $to_encoding.'//TRANSLIT', $source); } }
[Edit See Also] SeeAlso:JString/transcode
Examples
<CodeExamplesForm />
