Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

encoding issue

 
Viidhya Kishore
Ranch Hand
Posts: 99
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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(){
window.opener.showProcessingSpan();
var url = '<%= sServletBaseHREF %>admin/manageUserItem.reassignOwnership.grs?itemType=' + itemType + '&owned=' + owned +'&<%=ManageUserItemController.ITEM_REASSIGN_TO_OWNER_TOKEN%>=' + reassignTo;
alert(url);
window.opener.document.location = url;
window.close();
}

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

Thanks,
-Viidhya
 
Eric Pascarello
author
Rancher
Posts: 15385
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You need to double it up than with a string replace.

CIT eh?

Eric
 
Viidhya Kishore
Ranch Hand
Posts: 99
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks a lot Eric!

Yes
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic