Transf. string or complete file to UTF-8 in XML tpl

Author Message

H-Works Agency

Wednesday 21 September 2005 10:23:11 am

My ezp 3.6.0 charset setting is on iso-8859-1 in .ini files.

My problem is that i need to return some content in xml files (for swf movie). The charset in this file needs to be UTF-8.

How can i encode the strings in utf-8 (something like the UTF8_encode() function in php) ? Would be some tpl function like {"string"|utf-8_encode}.

Or can i force the whole xml ".tpl" file to use the UTF-8 charset (i tried to add "<xml (...) encoding="UTF-8"> but doesn't change anything ) ?

The problem for all this is that accent are not interpreted with my default charset in flash.

Thanx for all.

Martin

EZP is Great

Björn Dieding@xrow.de

Wednesday 21 September 2005 2:03:43 pm

turn your internal and template charset to utf8 this should help

watch your db charset though if your db does no support utf8 set it to latin1

Looking for a new job? http://www.xrow.com/xrow-GmbH/Jobs
Looking for hosting? http://hostingezpublish.com
-----------------------------------------------------------------------------
GMT +01:00 Hannover, Germany
Web: http://www.xrow.com/

H-Works Agency

Wednesday 21 September 2005 6:16:56 pm

Thanx a lot but isn't it possible to encode in UTF-8 only for a string or a file ?

Why does the {*template charset=UTF-8*} at the start of the tpl doesn't do anything ?

Thanx again. Martin

EZP is Great

Nathan Kelly

Wednesday 21 September 2005 11:54:25 pm

Hi, basically {*template charset=UTF-8*} in the template has no effect on the output, as far as I know this is only for EzP to pass the template code, Latin1 is the default template code and I'd suggest you don't change this unless its imperative, though I'm not sure what effect it actually has.

If you only need to encode a string I'd say you will have to write a PHP function for that particular string and maybe add some info to settings/template.ini to initialise the string conversion (don't ask me how), otherwise I'd go with Björn's suggestion, but thats as much as I know!

Hope that helps?

Cheers!

Pardon me while I burst into flames...

H-Works Agency

Thursday 22 September 2005 1:30:26 pm

Ok i found the answer for other users.

I found it because EZP handle this case !!! What a great software...

If you want to translate a string to UTF-8 go to :

template.ini =>

[PHP]
PHPOperatorList[to_utf8]=utf8_encode

Then in you template make a {$string|to_utf8}

It works for me and accent are displayed in my flash movie

EZP is Great

Powered by eZ Publish™ CMS Open Source Web Content Management. Copyright © 1999-2014 eZ Systems AS (except where otherwise noted). All rights reserved.

eZ debug

Timing: Jan 18 2025 22:40:28
Script start
Timing: Jan 18 2025 22:40:28
Module start 'layout'
Timing: Jan 18 2025 22:40:28
Module start 'content'
Timing: Jan 18 2025 22:40:28
Module end 'content'
Timing: Jan 18 2025 22:40:28
Script end

Main resources:

Total runtime0.0168 sec
Peak memory usage2,048.0000 KB
Database Queries3

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0068 588.1563152.6563
Module start 'layout' 0.00680.0033 740.812539.4922
Module start 'content' 0.01010.0044 780.304793.3828
Module end 'content' 0.01450.0023 873.687538.3047
Script end 0.0168  911.9922 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.002716.0621140.0002
Check MTime0.00127.0475140.0001
Mysql Total
Database connection0.00084.604410.0008
Mysqli_queries0.002715.885130.0009
Looping result0.00000.113310.0000
Template Total0.001810.710.0018
Template load0.00095.435710.0009
Template processing0.00095.185010.0009
Override
Cache load0.00063.622910.0006
General
dbfile0.00031.886580.0000
String conversion0.00000.055240.0000
Note: percentages do not add up to 100% because some accumulators overlap

Templates used to render the page:

UsageRequested templateTemplateTemplate loadedEditOverride
1print_pagelayout.tpl<No override>extension/community/design/community/templates/print_pagelayout.tplEdit templateOverride template
 Number of times templates used: 1
 Number of unique templates used: 1

Time used to render debug report: 0.0001 secs