Re: parameter special characters are converting into junk characters.

Splash Forums PrettyFaces Users parameter special characters are converting into junk characters. Re: parameter special characters are converting into junk characters.

#23111

Carolina
Member

Cristian,

I am using hyphen ‘-‘ for other parameter (Ex: list items Origin=value1 – value2 – value3) and in java i am splitting with ‘-‘ hyphen and converting as array. if i use same ‘-‘ character then the date will come only day.

For example:

http://localhost:8080/b2c?origin=DXB – BLR – NYC&dept_date=12-10-2012 – 15-10-2012 – 18-10-2012

in this case if i am going to split the params with ‘-‘ hyphen then i will get wrong date in getParameter.

How could i get list of dept_date in this case?

String[] departureDate = (request.getParameter(“dept_date”)).split(“-“); // Result will get wrong

Thats the reason i have to use ‘/’ character for date, but this is reserve character.

Can I do any encoding and show date with ‘/’ characters?

Even though I have used encoder for setting date like below.

SimpleDateFormat dateFormat = new SimpleDateFormat(“dd/MM/yyyy”);

departuredate.append(URLEncoder.encode(dateFormat.format(departure.getDepartDate())));

BUT I COULD SEE THE URL IN BROWSER LIKE:

&depart_date=31%252F10%252F2012&arrival_date=07%252F11%252F2012&