request.getParameter("x") character conversion problem


DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 2 of 2

Thread: request.getParameter("x") character conversion problem

  1. #1
    Milan Horvath Guest

    request.getParameter("x") character conversion problem


    Hi there,

    I have a well working servlet application and a little bug: in the Servlet's
    doGet mehtod, the parX = request.getparameter("x");
    gives me the value of HTTP parameter "x", but I get ?s (question marks) instead
    of two special Hungarian characters.
    I use
    PrintWriter out = new PrintWriter (new OutputStreamWriter(response.getOutputStream(),"Cp1250"));
    instead of
    PrintWriter out = new PrintWriter (response.getOutputStream());
    and this way the output can contain fine Hungarian special characters, but
    my problem is about is the input stream...

    Any idea is highly appreciated.

    Milan Horvath

  2. #2
    Majid Guest

    Re: request.getParameter("x") character conversion problem


    Dear Milan,
    It might be because parameters are passed as query string. The Query string
    (i.e. the string passed with URL in format like www.hotmail.com?id=0900)
    can't contain special characters like '\' and others .... check if this is
    the problem ....
    If such a case arises then one needs to send hexadecimal equivalent of that
    char. In case of '\' it is '%2F'

    Hope it helps.


    "Milan Horvath" <horv_m@freemail.hu> wrote:
    >
    >Hi there,
    >
    >I have a well working servlet application and a little bug: in the Servlet's
    >doGet mehtod, the parX = request.getparameter("x");
    >gives me the value of HTTP parameter "x", but I get ?s (question marks)

    instead
    >of two special Hungarian characters.
    >I use
    >PrintWriter out = new PrintWriter (new OutputStreamWriter(response.getOutputStream(),"Cp1250"));
    >instead of
    >PrintWriter out = new PrintWriter (response.getOutputStream());
    >and this way the output can contain fine Hungarian special characters, but
    >my problem is about is the input stream...
    >
    >Any idea is highly appreciated.
    >
    >Milan Horvath



Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center