Table of Contents

setCharset

API Package Subpackage Class Method Reference Last reviewed Doc status
API Home Package Joomla.Framework Subpackage Document Class JDocument Method setCharset Reference setCharset() Never Work in Progress

Sets the character set of the current document.

Syntax

void setCharset ( $type )

$type string is a string containing the new character set identifier. This parameter is optional and if omitted defaults to ‘utf-8’.

Examples

Set the character set of the current document.

Example

global $mainframe;

$document =& JFactory::getDocument();
$document->setCharset( 'utf-8' );

echo "Character Set: " . $document->getCharset();

Might produce:

Result

Character Set: utf-8