Specifies the encoding of strings used in methods arguments.
void object->SetEncoding( int encoding )
The default encoding is the standard PHP encoding. However it is sometimes usefull to directly specify UTF-8 strings in methods arguments instead of using the standard encoding.
The possible encodings are:
| Value | Constant | Definition |
|---|---|---|
0 |
SWIFFCHART_DEFAULT_ENCODING | Use the default PHP encoding |
1 |
SWIFFCHART_UTF8_ENCODING | Directly use UTF-8 strings |
The following PHP code illustrates use of the SetEncoding method.
// $title and $subtitle are UTF-8 encoded strings
$title= "Wikipedia: L'encyclop\xC3\xA9die libre";
$subtitle= utf8_encode( html_entity_decode("Wikipedia: Die freie Enzyklopädie") );
// Set UTF-8 encoding
$chart->SetEncoding( SWIFFCHART_UTF8_ENCODING );
// the UTF-8 strings can now be directly used by the API
$chart->SetTitle($title);
$chart->SetSubtitle($subtitle);
// print them in the html page
print htmlentities( utf8_decode($chart->GetTitle()) )."<br>";
print htmlentities( utf8_decode($chart->GetSubtitle()) )."<br>";
Applies To: Chart Object