[EMAIL PROTECTED] writes:

> I'm seeing problems when I put certain Japanese strings in template
> files.

[...]

> File "./TMDA/Util.py", line 602, in maketext
> TypeError: not enough arguments for format string

[...]

> When I remove the Japanese text, I don't see the problem occurring
> -- i.e. I get normal behavior.  FWIW, it appears to occur with some
> Japanese text but not others.

I decided to revisit[1] this issue given the recent interest in making
TMDA more multi-lingual.  What I learned is that Japanese is the most
difficult language to deal with when internationalizing applications
<wink>.

Here is the executive summary:

Japanese has three coding schemes (iso-2022-jp, shift-jis, and
euc-jp).  iso-2022-jp is used for mail and news messages.  

However, iso-2022-jp is not well suited for programming because it is
7bit and contains special characters like `\', `%', and `&'.  This is
what is causing problems for TMDA when iso-2022-jp is used directly in
the templates.

The consensus for how to deal with this is:

o Store the templates in euc-jp which will not cause Python problems
  when doing string substitution via dictionary interpolation.

o Then before the message is sent, convert the euc-jp text to
  iso-2022-jp.

This is how Mailman does it, and TMDA's template system is almost
identical to theirs.  The email package includes the code to do these
conversions.

The only other alternatives are to escape all `%' signs as `%%', or do
a double charset conversion.  That is, store the templates in
iso-2022-jp, then convert to euc-jp before string substitution, and
then convert back to iso-2022-jp before sending.  Both of these
look pretty ugly to me.

I don't have much experience with Japanese input methods, so do you
anticipate any problems with this?  i.e, will it be easy for Japanese
TMDA users to maintain their templates in euc-jp instead of
iso-2022-jp?

Footnotes:

1.  For more details, see the mailman-developers thread I started at:
http://mail.python.org/pipermail-21/mailman-developers/2002-September/013266.html

_________________________________________________
tmda-workers mailing list ([EMAIL PROTECTED])
http://tmda.net/lists/listinfo/tmda-workers

Reply via email to