Ali Raza
Ali Raza

Reputation: 21

How joomla selects charset?

I was wondering and searching, how joomla selects charset to display in HTML document head. The meta charset encoding tag is included in index.php of template using:

<jdoc:include type="head" />

i have searched and found that, from where this code get rendered, it's path is:

/libraries/joomla/document/renderer/head.php

Please, help me with this. I am really confused with this thing. I also want to know how can i change charset?

Upvotes: 1

Views: 1191

Answers (1)

Ali Raza
Ali Raza

Reputation: 21

After 3 hours of searching, searching and searching i posted this question at SO but i did not quit my search and tracebacked head.php it was using document.php to get charset for rendering, then i used notepad++ to search for the usage of JDocument class, and i found that it was used and instantiated at multiple locations, but the thing i was searching was in:

/libraries/joomla/factory.php

Following code was used to preset charset in factory.php and create document for rendering:

$attributes = array(
    'charset' => 'utf-8',
    'lineend' => 'unix',
    'tab' => '  ',
    'language' => $lang->getTag(),
    'direction' => $lang->isRTL() ? 'rtl' : 'ltr',
    'mediaversion' => $version->getMediaVersion()
);

return JDocument::getInstance($type, $attributes);

I changed charset to windows-1252 and it works for me. :)

Upvotes: 1

Related Questions