struts-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "GenePi Conseil" <gen...@sympatico.ca>
Subject Re: message tag problems
Date Thu, 07 Sep 2000 13:13:44 GMT
Hi Oleg,

Seems your database data and your messages use two different charsets.
    database = windows-1251
    message resource = ISO-8859-1

So, one of them has to do a conversion. Either change it in the database
(1): there's frequently an option to set the data encoding, but generally
you have to dump all data, recreate the database and restore the data. Or do
the conversion in your beans (2). Or else patch the <struts:message> tag to
add a "charset" attribute that would do the conversion from ISO-8859-1 to
windows-1251 (3).

The solution (3) would benefit to other people, but you have to write all
your pages with:

    <!-- Set the charset for the database -->
    <%@ page contentType="text/html;charset=windows-1251" %>

    <!-- Read the message from an ISO-8859-1 file and convert it to
Windows-1251 -->
    <struts:message key="my.message" charset="windows-1251" />

repeating the transcoding to use for each message. The conversion can be
done opening a InputStreamReader and specifying the charset to use.

I'm not an expert in that field, but what don't you use ISO-8859-5 or
KOI8-R, the "natural" charset for russian?

Hope this helps.

Pierre Métras

----- Original Message -----
From: "Oleg V Alexeev" <gonza@penza.net>
To: <struts-dev@jakarta.apache.org>
Sent: Thursday, September 07, 2000 5:49 AM
Subject: message tag problems


> Hello friends,
>
>   I have a problem with using <struts:message> tag. English and
>   Russian properties files located in some directiry and
>   <struts:message> work fine with it - prints Russian or English
>   strings according current locale.
>   But when I use in my pages beans for database access I need to
>   insert to my pages such directive as
>
>    <%@ page contentType="text/html;charset=windows-1251" %>
>
>   because of data retrieved from database prints as '?' without this
>   directive. And with this directive <struts:message> prints its
>   messages as '?' too! What is this? How can I break this magic ring?
>
> --
> Best regards,
>  Oleg                            mailto:gonza@penza.net
>
>
>


Mime
View raw message