Hi.

The goal is to use TT for an order confirmation, to be sent by email.

The template file itself is written in UTF-8, the variable strings
(coming from the web) are converted from ISO-8859-1 to utf-8 with
Locale::Recode. The conversion works fine, Umlauts (diacritical chars)
like äöü and such are printed correctly.

The problem:
I use these strings in formats to get a tabular layout, for example of
the ordered products. At another place I convert the vars to String
objects and use var.left(40).

Now, whenever the string contains an Umlaut, the format comes up one
short in length. If the string contains two Umlauts, it comes up short
by two characters etc.

Example: (Will only show properly in monospaced fonts)
POS NUM ARTICLE TEXT567890123456789012345678901234567890 Price
010   1 A000001 Item for something                        5.30
020   1 B999998 Teil für irgendwas                       5.30

The article text should be 40 chars long, left aligned, right space
padded, so that the prices at the right line up nicely.

The format for the item line above is
[% FOREACH a IN o.artikel %]
[% USE art = format("%0.3d % 3d %- 7s %- 40s %7.2f");
art( loop.count*10, a.0, a.1, a.2, a.3 )
+%]
[% END %]

Tried so far:
- TT config option 'Encoding' => 'utf8'; no change
- padding the article text in the Perl script to 40 chars, no change

Environment is an all UTF-8 Locale (de_DE.utf-8), Ubuntu Server 10.04LTS.
TT is version 2.22.


Any ideas?

TIA,
Ekki

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

Reply via email to