On Thu, 13 Dec 2001, yilmaz wrote:
> Date: Thu, 13 Dec 2001 09:51:02 +0800
> From: yilmaz <[EMAIL PROTECTED]>
> Reply-To: Tomcat Users List <[EMAIL PROTECTED]>
> To: Tomcat Users List <[EMAIL PROTECTED]>
> Subject: Re: charset problem in java beans
>
> Okey,Craig you were right that before adding the item into the hashtable it
> was garbled.
> when i trace back to the origin of that parameter, i see that it comes from
> an html form filled
> by a user from another jsp page. then the problem became like this:
> how or what should i do to be able to receive meaningful big5 chars from an
> html form?
In Tomcat4, you can use the new Servlet 2.3 call
request.setCharacterEncoding(). If you do this before calling any of the
request.getParameter() type calls, Tomcat will do the translation for you.
> As i previously faced the same problem, i knew how to solve it.
> (using jason hunter's ParameterParser class)
> As a result my porgram works correctly, now.
>
> thanks a lot. I appreciate your help with this problem.
> best regards :)
Craig
>
>
> ----- Original Message -----
> From: "Craig R. McClanahan" <[EMAIL PROTECTED]>
> To: "Tomcat Users List" <[EMAIL PROTECTED]>
> Sent: Thursday, December 13, 2001 2:20 AM
> Subject: Re: charset problem in java beans
>
>
> > It's most likely an issue of where you got the data to load into your
> > hashtable in the first place. For example, if it's loaded from a
> > database, you must ensure that your database understands that it should
> > use Big5 for those characters as well.
> >
> > Craig
> >
> >
> > On Wed, 12 Dec 2001, yilmaz wrote:
> >
> > > Date: Wed, 12 Dec 2001 19:23:33 +0800
> > > From: yilmaz <[EMAIL PROTECTED]>
> > > Reply-To: Tomcat Users List <[EMAIL PROTECTED]>
> > > To: Tomcat Users List <[EMAIL PROTECTED]>
> > > Subject: Re: charset problem in java beans
> > >
> > > thanks Craig,
> > >
> > > Craig wrote :
> > > >
> > > > It sounds like you might be working too hard :-).
> > >
> > > how did you understand? :)
> > >
> > > >
> > > > Internally, Java keeps all String values in Unicode. When you
> actually
> > > > write the response, it will be converted according to the character
> > > > encoding you specify on the page.
> > >
> > > theoretically you are right, but unfortunately in real applications , it
> > > seems it is not like that.
> > >
> > > >
> > > > If you're using JSP you would put this at the top of your page:
> > > >
> > > > <%@ page contentType="text/html;charset=Big5" %>
> > > >
> > >
> > > it is already at the top of my every single jsp page.
> > >
> > > > and then write out the values something like this:
> > > >
> > > > <%= sb.getItemname(itemid) %>
> > >
> > >
> > > i already have this too in my code,too.
> > >
> > > >
> > > > From a servlet, the important issue is to set the content type and
> > > > character encoding *before* you get the PrintWriter:
> > > >
> > > > response.setContentType("text/html;charset=Big5");
> > > > PrintWriter writer = response.getWriter();
> > > > ...
> > > > writer.print(sb.getItemname(itemid));
> > > >
> > > > In either case, Java will perform the Unicode->Big5 conversion for
> you.
> > >
> > > then why am i keeping on getting garbled symbols instead of traditional
> > > chinese chars?
> > > by the way, other than the strings retreived from the bean, other big5
> chars
> > > are displyed correctly.
> > > it seems that the problem occurs when the data is stored in the hahtable
> or
> > > when it is retreived.
> > > thanks again for your help.
> > > best regards :)
> > > >
> > > > Craig McClanahan
> > > >
> > > >
> > > >
> > > > --
> > > > To unsubscribe: <mailto:[EMAIL PROTECTED]>
> > > > For additional commands: <mailto:[EMAIL PROTECTED]>
> > > > Troubles with the list: <mailto:[EMAIL PROTECTED]>
> > > >
> > > >
> > >
> > >
> > >
> > > --
> > > To unsubscribe: <mailto:[EMAIL PROTECTED]>
> > > For additional commands: <mailto:[EMAIL PROTECTED]>
> > > Troubles with the list: <mailto:[EMAIL PROTECTED]>
> > >
> > >
> >
> >
> > --
> > To unsubscribe: <mailto:[EMAIL PROTECTED]>
> > For additional commands: <mailto:[EMAIL PROTECTED]>
> > Troubles with the list: <mailto:[EMAIL PROTECTED]>
> >
> >
>
>
>
> --
> To unsubscribe: <mailto:[EMAIL PROTECTED]>
> For additional commands: <mailto:[EMAIL PROTECTED]>
> Troubles with the list: <mailto:[EMAIL PROTECTED]>
>
>
--
To unsubscribe: <mailto:[EMAIL PROTECTED]>
For additional commands: <mailto:[EMAIL PROTECTED]>
Troubles with the list: <mailto:[EMAIL PROTECTED]>