You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by meeboo <de...@gmail.com> on 2007/05/03 20:55:07 UTC

[S2] UTF-8 woes

Hey all

I am trying to submit form data with UTF-8 characters but am having no luck.
The special characters are garbled when inserted in the database from a
<s:form> for example - this is regardless of what browser I am using. I am
using a page content type declaration for each page, but that doesn't help
at all. Do I need to declare it somewhere else in my Struts 2 application? I
remember that I in my old JSP/Servlet app had to convert certain characters
to special UTF-8 characters before saving Strings etc... but in S2 all I get
is question marks for special characters when I inspect incoming UTF-8
strings.

I am using this content type declaration. 
<%@ page contentType="text/html; charset=ISO-8859-15" %> 

I also used <%@ page pageEncoding="UTF-8" %> but to no avail.

Help!

Thanks!
-- 
View this message in context: http://www.nabble.com/-S2--UTF-8-woes-tf3688315.html#a10311092
Sent from the Struts - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Re: [S2] UTF-8 woes

Posted by Cristian Lucero <cr...@gmail.com>.
try this
<meta http-equiv="Content-Type" content="text/html;
charset=ISO-8859-1"></meta>


On 5/3/07, meeboo <de...@gmail.com> wrote:
>
>
> Hey all
>
> I am trying to submit form data with UTF-8 characters but am having no
> luck.
> The special characters are garbled when inserted in the database from a
> <s:form> for example - this is regardless of what browser I am using. I am
> using a page content type declaration for each page, but that doesn't help
> at all. Do I need to declare it somewhere else in my Struts 2 application?
> I
> remember that I in my old JSP/Servlet app had to convert certain
> characters
> to special UTF-8 characters before saving Strings etc... but in S2 all I
> get
> is question marks for special characters when I inspect incoming UTF-8
> strings.
>
> I am using this content type declaration.
> <%@ page contentType="text/html; charset=ISO-8859-15" %>
>
> I also used <%@ page pageEncoding="UTF-8" %> but to no avail.
>
> Help!
>
> Thanks!
> --
> View this message in context:
> http://www.nabble.com/-S2--UTF-8-woes-tf3688315.html#a10311092
> Sent from the Struts - User mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>


-- 
Cristian Lucero

Re: [S2] UTF-8 woes

Posted by meeboo <de...@gmail.com>.
We have got everything working now except for handling UTF8 strings when
doing file uploads from IE6 in Resin. It seems as if multipart/form-data
requests don't play well in this certain environment (we have tried it in
Tomcat and it works there). Has anyone had experience with file uploads from
IE6 to a application ran in Resin?

Thanks!


Christopher Schultz-2 wrote:
> 
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
> 
> meeboo,
> 
> meeboo wrote:
>> But that other poster was using Struts 1! Also, I am already using 
>> <meta http-equiv="Content-Type" content="text/html;
>> charset=ISO-8859-1"></meta> 
>> Has anyone had luck using for example å ä ö in S2 ?
> 
> What is the character set actually being used by the request and the
> response? Just because you have ISO-8859-1 in your <meta> tag doesn't
> mean that the response is actually being sent and the request is
> actually being interpreted as ISO-8859-1.
> 
> Here are some things to look at:
> 
> 1. What does request.getCharacterEncoding return?
> 2. What does response.getCharacterEncoding return?
> 3. What does System.getProperty("file.encoding") return?
> 4. What does your HTTP or AJP listener have configured for
>    its default character set? (In Tomcat, the connectors
>    can use a default charset when the client does not provide
>    one in the request headers).
> 5. You never mentioned whether you were using GET or POST. There
>    is a difference in how the data is decoded.
> 
> - -chris
> 
> -----BEGIN PGP SIGNATURE-----
> Version: GnuPG v1.4.7 (MingW32)
> Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
> 
> iD8DBQFGOkSH9CaO5/Lv0PARAhC9AJ4rwoZJfegWReU+S5cenabnKOhDhQCgp2yA
> sKE5xIBugzsYFhEvKmjE+Qg=
> =jLc4
> -----END PGP SIGNATURE-----
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
> 
> 
> 

-- 
View this message in context: http://www.nabble.com/-S2--UTF-8-woes-tf3688315.html#a10372401
Sent from the Struts - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Re: [S2] UTF-8 woes

Posted by Christopher Schultz <ch...@christopherschultz.net>.
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

meeboo,

meeboo wrote:
> But that other poster was using Struts 1! Also, I am already using 
> <meta http-equiv="Content-Type" content="text/html;
> charset=ISO-8859-1"></meta> 
> Has anyone had luck using for example å ä ö in S2 ?

What is the character set actually being used by the request and the
response? Just because you have ISO-8859-1 in your <meta> tag doesn't
mean that the response is actually being sent and the request is
actually being interpreted as ISO-8859-1.

Here are some things to look at:

1. What does request.getCharacterEncoding return?
2. What does response.getCharacterEncoding return?
3. What does System.getProperty("file.encoding") return?
4. What does your HTTP or AJP listener have configured for
   its default character set? (In Tomcat, the connectors
   can use a default charset when the client does not provide
   one in the request headers).
5. You never mentioned whether you were using GET or POST. There
   is a difference in how the data is decoded.

- -chris

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.7 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFGOkSH9CaO5/Lv0PARAhC9AJ4rwoZJfegWReU+S5cenabnKOhDhQCgp2yA
sKE5xIBugzsYFhEvKmjE+Qg=
=jLc4
-----END PGP SIGNATURE-----

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Re: [S2] UTF-8 woes

Posted by meeboo <de...@gmail.com>.
But that other poster was using Struts 1! Also, I am already using 
<meta http-equiv="Content-Type" content="text/html;
charset=ISO-8859-1"></meta> 
Has anyone had luck using for example å ä ö in S2 ?

I am a very savvy Struts 2 mailing list user you know :)


<meta http-equiv="Content-Type" content="text/html;
charset=ISO-8859-1"></meta> 


Christopher Schultz-2 wrote:
> 
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
> 
> meeboo,
> 
> It's amazing to me that people not only don't read the archives, but
> they also don't read the messages posted on the same day or even in the
> /same hour/. :(
> 
> - -chris
> 
> meeboo wrote:
>> Hey all
>> 
>> I am trying to submit form data with UTF-8 characters but am having no
>> luck.
>> The special characters are garbled when inserted in the database from a
>> <s:form> for example - this is regardless of what browser I am using. I
>> am
>> using a page content type declaration for each page, but that doesn't
>> help
>> at all. Do I need to declare it somewhere else in my Struts 2
>> application? I
>> remember that I in my old JSP/Servlet app had to convert certain
>> characters
>> to special UTF-8 characters before saving Strings etc... but in S2 all I
>> get
>> is question marks for special characters when I inspect incoming UTF-8
>> strings.
>> 
>> I am using this content type declaration. 
>> <%@ page contentType="text/html; charset=ISO-8859-15" %> 
>> 
>> I also used <%@ page pageEncoding="UTF-8" %> but to no avail.
>> 
>> Help!
>> 
>> Thanks!
> -----BEGIN PGP SIGNATURE-----
> Version: GnuPG v1.4.7 (MingW32)
> Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
> 
> iD4DBQFGOjVa9CaO5/Lv0PARAqQeAJjR3Q4cAAOViTNxlRbVB9jH+/COAJ9bRghJ
> Gf3FpAnWCwY9yquHPPsKLw==
> =S2nd
> -----END PGP SIGNATURE-----
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
> 
> 
> 

-- 
View this message in context: http://www.nabble.com/-S2--UTF-8-woes-tf3688315.html#a10312120
Sent from the Struts - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Re: [S2] UTF-8 woes

Posted by Christopher Schultz <ch...@christopherschultz.net>.
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

meeboo,

It's amazing to me that people not only don't read the archives, but
they also don't read the messages posted on the same day or even in the
/same hour/. :(

- -chris

meeboo wrote:
> Hey all
> 
> I am trying to submit form data with UTF-8 characters but am having no luck.
> The special characters are garbled when inserted in the database from a
> <s:form> for example - this is regardless of what browser I am using. I am
> using a page content type declaration for each page, but that doesn't help
> at all. Do I need to declare it somewhere else in my Struts 2 application? I
> remember that I in my old JSP/Servlet app had to convert certain characters
> to special UTF-8 characters before saving Strings etc... but in S2 all I get
> is question marks for special characters when I inspect incoming UTF-8
> strings.
> 
> I am using this content type declaration. 
> <%@ page contentType="text/html; charset=ISO-8859-15" %> 
> 
> I also used <%@ page pageEncoding="UTF-8" %> but to no avail.
> 
> Help!
> 
> Thanks!
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.7 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD4DBQFGOjVa9CaO5/Lv0PARAqQeAJjR3Q4cAAOViTNxlRbVB9jH+/COAJ9bRghJ
Gf3FpAnWCwY9yquHPPsKLw==
=S2nd
-----END PGP SIGNATURE-----

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org