This week's book giveaway is in the JavaFX forum.
We're giving away four copies of Introducing JavaFX 8 Programming and have Herbert Schildt on-line!
See this thread for details.
The moose likes HTML, CSS and JavaScript and the fly likes encoding issue Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Introducing JavaFX 8 Programming this week in the JavaFX forum!
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Bookmark "encoding issue" Watch "encoding issue" New topic

encoding issue

Viidhya Kishore
Ranch Hand

Joined: Jan 03, 2007
Posts: 99
Hello all,
I am passing a user name as a URL queryString.
The user name has a back slash which is getting escaped.
Please help.
Code :

js fn -
var reassignTo = '<%=request.getAttribute("reassignTo") %>'; // user name is 'NIH\ADAMSBR'
function reassignOwnership(){
var url = '<%= sServletBaseHREF %>admin/manageUserItem.reassignOwnership.grs?itemType=' + itemType + '&owned=' + owned +'&<%=ManageUserItemController.ITEM_REASSIGN_TO_OWNER_TOKEN%>=' + reassignTo;
window.opener.document.location = url;

When I alert the URL, 'NIH\ADAMSBR' comes as 'NIHADAMBR'.
Please help (

Eric Pascarello

Joined: Nov 08, 2001
Posts: 15385
You need to double it up than with a string replace.

CIT eh?

Viidhya Kishore
Ranch Hand

Joined: Jan 03, 2007
Posts: 99
Thanks a lot Eric!

I agree. Here's the link:
subject: encoding issue
It's not a secret anymore!