Forums / Setup & design / template encoding problem

template encoding problem

Author Message

Marc Boon

Tuesday 14 February 2006 6:04:07 am

I am setting up a multilingual site (english, german, arabic) and the arabic templates don't appear in the right encoding. I have specified utf-8 everywhere possible, but the template texts are unreadable. It looks like they are converted to some other character encoding.

When I open the templates directly in the browser, arabic text is displayed correctly. Also in dreamweaver the templates look fine.

Even more, arabic content (eg. an article) entered through the admin interface, shows up in arabic script as intended on the public site. Only the text which are hardcoded in the templates are displayed in the wrong encoding, and thus unreadable.

When I check the http headers and xhtml source, all says utf-8, but the template text is mangled somewhere in the process.

Any idea what is happening here?

Marc Boon

Tuesday 14 February 2006 7:35:37 am

When template debugging is swtitched on, I get several notices like this:

Notice:
design/islam_ar/override/templates/page_start.tpl, iso-8859-1

The mention of iso-8859-1 might be the cause of the problem. Is the template regarded as encoded in iso-8859-1 and then translated to utf-8?
This should not be done, since this (custom) template is already utf-8 encoded, and has arabic text in it.

How do I specify the encoding of the template files? Is there some template code that has to be inserted, or is it some ini file setting?

Marc Boon

Thursday 16 February 2006 6:37:27 am

I tried to work around this problem by converting all text that doesn't fit in the iso-8859-1 encoding to character entities (using Dremweaver, saving a utf-8 document as iso-8859-1), Dreamweaver converts the text to character entities (like ع) which are not affected by the template parsing, and hence display correctly.

Of course this is not a good solution, and I would greatly appreciate some feedback from the ez crew on this template encoding issue.

Marc Boon

Monday 13 March 2006 2:03:29 am

I found this in template.ini:

[CharsetSettings]
# The charset to use if no charset is specified in the template
DefaultTemplateCharset=iso-8859-1

So, I can set the default charset for all templates, but how do you specify a charset in a single template?

Kristian Hole

Monday 13 March 2006 2:11:07 am

If you look in the standard templates you will see an comment like this in the top of each file:


{*?template charset=latin1?*}

That way you can specify the charset for each template.

Kristian

http://ez.no/ez_publish/documenta...tricks/show_which_templates_are_used
http://ez.no/doc/ez_publish/techn...te_operators/miscellaneous/attribute