API15

JString/transcode: Difference between revisions

From Joomla! Documentation

Doxiki (talk | contribs)
New page: ===Description=== Transcode a string. <span class="editsection" style="font-size:76%;"> <nowiki>[</nowiki>Edit Descripton<nowiki>]</nowiki> </span> ...
 
m preparing for archive only
 
(One intermediate revision by the same user not shown)
Line 3: Line 3:


<span class="editsection" style="font-size:76%;">
<span class="editsection" style="font-size:76%;">
<nowiki>[</nowiki>[[Description:JString/transcode|Edit Descripton]]<nowiki>]</nowiki>
<nowiki>[<! removed edit link to red link >]</nowiki>
</span>
</span>


{{Description:JString/transcode}}
<! removed transcluded page call, red link never existed >


===Syntax===
===Syntax===
Line 54: Line 54:


<span class="editsection" style="font-size:76%;">
<span class="editsection" style="font-size:76%;">
<nowiki>[</nowiki>[[SeeAlso:JString/transcode|Edit See Also]]<nowiki>]</nowiki>
<nowiki>[<! removed edit link to red link >]</nowiki>
</span>
</span>
{{SeeAlso:JString/transcode}}
<! removed transcluded page call, red link never existed >


===Examples===
===Examples===
<CodeExamplesForm />
=== Code Examples ===
<dpl>
<dpl>
  noresultsheader=\n
  noresultsheader=\n
  category=transcode
  category=transcode
  category=JString
  category=JString
  category=CodeExample
  namespace=CodeExample
  category=MethodExample
  category=MethodExample
  include=*
  include=*
  format= ,,,
  format= ,,,
</dpl>
</dpl>
[[Category:Archived pages API15]]

Latest revision as of 01:10, 25 March 2017

Description

Transcode a string.

[<! removed edit link to red link >]

<! removed transcluded page call, red link never existed >

Syntax

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

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);
        }
}

[<! removed edit link to red link >] <! removed transcluded page call, red link never existed >

Examples

Code Examples