You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@struts.apache.org by Oleg V Alexeev <go...@penza.net> on 2000/09/07 11:49:19 UTC
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
Re[2]: message tag problems
Posted by Oleg V Alexeev <go...@penza.net>.
Hello Pierre,
Thursday, September 07, 2000, 5:13:44 PM, you wrote:
GC> Seems your database data and your messages use two different charsets.
GC> database = windows-1251
GC> message resource = ISO-8859-1
It's right.
...
GC> I'm not an expert in that field, but what don't you use ISO-8859-5 or
GC> KOI8-R, the "natural" charset for russian?
We have MS SQL Server as database and it is not our choice.. 8((
Thank you for your participation, your method (3) is good idea.
--
Best regards,
Oleg mailto:gonza@penza.net
Re: message tag problems
Posted by GenePi Conseil <ge...@sympatico.ca>.
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" <go...@penza.net>
To: <st...@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
>
>
>