From: Live DVB on
I'm having this encoding issue that drives me nuts.

Basically there's a form:

<%@page contentType="text/html" pageEncoding="UTF-8"%>
(...)
head>
<meta http-equiv="Content-Type" content="text/html;
charset=UTF-8">
</head>
(...)
<h1> Header: š ć đ č <h1>
<% out.println("Print: " + request.getParameter("txtArea")); %>
<form method="post" action="newjsp.jsp">
<textarea name="txtArea">š ć đ č</textarea>
<input type="submit" value="Submit"/>
</form>
--
1) When i press submit it prints out " š ć đ č "
2) If I change encoding from UTF-8 to Windows-1250, I get lots of
question marks: ? ? ? ?
3) If i change encoding from UTF-8 to iso-8859-1, the data prints ok,
but <h1> Header: š ć đ č <h1> becomes <h1> Header: ? ? ? ? <h1>
4) If I change method to GET with utf-8 encoding everything's fine

p.s. "š ć đ č" are croatian letters
From: Live DVB on
On Apr 27, 5:21 pm, Live DVB <live...(a)gmail.com> wrote:
> /cut

Well in the end, after few more hours of work I changed URIEncoding to
"windows-1250" at my server.xml, also changed all utf-8 to
windows-1250. I then changed the letters with their ascii(hex?)
counterparts &#269; etc. I guess that's it.
From: Arne Vajhøj on
On 27-04-2010 11:21, Live DVB wrote:
> I'm having this encoding issue that drives me nuts.
>
> Basically there's a form:
>
> <%@page contentType="text/html" pageEncoding="UTF-8"%>
> (...)
> head>
> <meta http-equiv="Content-Type" content="text/html;
> charset=UTF-8">
> </head>
> (...)
> <h1> Header: š ć đ č<h1>
> <% out.println("Print: " + request.getParameter("txtArea")); %>
> <form method="post" action="newjsp.jsp">
> <textarea name="txtArea">š ć đ č</textarea>
> <input type="submit" value="Submit"/>
> </form>
> --
> 1) When i press submit it prints out " š ć đ č "
> 2) If I change encoding from UTF-8 to Windows-1250, I get lots of
> question marks: ? ? ? ?
> 3) If i change encoding from UTF-8 to iso-8859-1, the data prints ok,
> but<h1> Header: š ć đ č<h1> becomes<h1> Header: ? ? ? ?<h1>
> 4) If I change method to GET with utf-8 encoding everything's fine
>
> p.s. "š ć đ č" are croatian letters

If you are consistent (labeling and actual content match), then
all encodings supported by the browser and server should work
fine.

To get it working with ISO-8859-1 / Windows-1250 I think you
need to save the file in that encoding instead if the UTF-8 it
apparently is saved in.

The first problem indicates is a bit more tricky. Somewhere
some UTF-8 is being interpreted as ISO-8859-1 / Windows-1250.
Default charset in Java maybe.

Arne
From: Arne Vajhøj on
On 27-04-2010 16:49, Live DVB wrote:
> On Apr 27, 5:21 pm, Live DVB<live...(a)gmail.com> wrote:
>> /cut
>
> Well in the end, after few more hours of work I changed URIEncoding to
> "windows-1250" at my server.xml, also changed all utf-8 to
> windows-1250.

That seems all fine.

> I then changed the letters with their ascii(hex?)
> counterparts&#269; etc. I guess that's it.

That is a poor hack.

You could most likely have fixed the last problem by
just saving the file in windows-1250.

Arne

From: Live DVB on
On Apr 28, 2:46 am, Arne Vajhøj <a...(a)vajhoej.dk> wrote:
> That is a poor hack.
>
> You could most likely have fixed the last problem by
> just saving the file in windows-1250.
>

Well you're correct of course, it's not really a good solution,
however, changing the encoding on project properties didn't solve the
problem. I'm not sure of some other way to do this (I'm using
Netbeans).