jQuery in Action, 2nd edition*
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 Android Security Essentials Live Lessons this week in the Android 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: 15376
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!

Consider Paul's rocket mass heater.
subject: encoding issue
Similar Threads
not able to get uploaded file size in javascript
toggle checkbox group when the max limit is reached
Encoding and Decoding
Script using array
Trouble getting IFRame Call to work