chkal/pf-issue-test — Issue #102: Ampersands not encoding in URL query string
Author: chkal
Created: 2012-03-06 07:35:39+00:00
State: open

Originally filed by **Michael....@gmail.com** on 2011-04-26T13:22:05

Google Code issue: http://code.google.com/p/prettyfaces/issues/detail?id=104

NOTE: For fastest resolution when reporting an issue, please provide attach example project or file *with sources* that reproduces the problem.

What steps will reproduce the problem?
1. Declare a JSF tag in a Facelets XHTML page where there are multiple elements that will map to query parameters (not path parameters). In the below example, "g" and "b" are the query parameters.

2. Refresh the page - the ampersand that separates the query parameters on the generated URL is a literal '&' character, not the expected '&' HTML entity representation.

What is the expected output? What do you see instead?
* The ampersand that separates the query parameters on the generated URL is a literal '&' character, not the expected '&' HTML entity representation.

What version of PrettyFaces are you using? On what server and version,
version of JSF, and other relevant technologies?
* PrettyFaces 3.3.0-SNAPSHOT with (Sun/Oracle) JSF 1.2 on IBM WebSphere 7 plus JSF Facelets 1.1.15.

Please provide any additional information below.
* The issue appears not to occur on other URLs, specifically form actions.

* Attempting to write a rewrite rule to convert '&' to '&' results in a "double" encoding of the ampersand. The expected output of '&' instead appears as '&amp;'. This occurs whether the rewrite took place via the XML rewrite tag and a supplied "substitution" element or via a custom Processor implementation.

* Modified com.ocpsoft.pretty.faces.url.QueryString#toQueryString to append '&' rather than '&', however this breaks the URL creation for other non-PrettyFaces JSF URLs such as form actions. Did not spend too much time looking through the rest of the source for another option...