Hi Ross,

   I'm having to do something similar. Solution was relatively involved.

   First, at the top of your code: use utf8;

   Store your data in mysql with collation utf8-bin. (I'm using mysql5.)

   When preparing your CGI variable, set: -encoding=>'utf-8'

In your html, put: <meta http-equiv="Content-Type" content="application/xhtml+xml; charset=UTF-8" />

However, there seem to be issues with UTF-8 handling in DBI/DBD, so I had to do the following to force my variable to be handled as UTF8 before stuffing it in my template:

   $num_octets = utf8::upgrade($article);

I got a lot of this from here: http://www.simplicidade.org/notes/archives/2005/12/utf8_and_dbdmys.html

Hope this helps,

Karl Dane
rince.net ltd
e. [EMAIL PROTECTED]
w. http://rince.net
m. 07885 040959
t. 01273 770008



Josh Rosenbaum wrote:
Hi Ross,

My guess would be that this is an encoding issue. Perhaps the values are stored as iso-8859-1 (or a variation) or windows cp1252 and you're serving the pages as utf-8. Or vice-versa. You'll probably need to convert them to whatever encoding you are using in the web page.

-- Josh

Ross Crawford wrote:
I'm a relative newbie to TT. I have a DB (MySQL) table with a list of ISO-3166 countries. Some of the country names have non-standard characters in them eg: CÔTE D'IVOIRE.

I load these into an array @countries, and try to put them in a combo list with:

        <select id="countrycode" name="countrycode">
[% FOREACH item IN countries %]
<option value="[% item.countrycode %]">[% item.countryname %]</option>
[% END %]
        </select>

But the non-standard characters all display as '?'. I've verified that they are correct after being read into the array, and my browser is capable of displaying them correctly. What do I need to do to get them to display correctly on my page? Is it even possible?


_______________________________________________
templates mailing list
[email protected]
http://lists.template-toolkit.org/mailman/listinfo/templates

_______________________________________________
templates mailing list
[email protected]
http://lists.template-toolkit.org/mailman/listinfo/templates

Reply via email to