The URI to be decoded is not a valid encoding

Hi,

I am creating a simple record update UI using listgrid with RestDataSource using JSON dataformat.
The program works fine most of the time when firing grid.saveAllEdits() which posts the updated data to the background.
However, whenever updating a record with a field containing ‘%’ (percentage) character, the RPC call to background doesn’t seem to be working, it just hangs. And in development console I can see following error messages:

13:40:21.187:MUP0:INFO:RPCManager:sendQueue[6]: 1 RPCRequest(s); transport: xmlHttpRequest; target: http://localhost:8080/showcase/../DBUpdate.do
13:40:21.187:MUP0:DEBUG:RPCManager:Using ActiveX XMLHttpRequest via constructor: MSXML2.XMLHTTP
13:40:21.249:MUP0:WARN:Log:Error:
‘The URI to be decoded is not a valid encoding’
in http://localhost:8080/showcase.html
at line 1053
Comm.sendXmlHttpRequest(_1=>Obj)
RPCManager.sendQueue(_1=>undef, _2=>undef, _3=>undef)
RPCManager.sendNoQueue(_1=>Obj)
RPCManager.sendRequest(_1=>Obj)
RPCManager.sendProxied(_1=>Obj, _2=>undef)
DataSource.sendDSRequest(_1=>Obj)
DataSource.performDSOperation(_1=>“update”, _2=>Obj, _3=>“isc_OID_99.$337(dsResponse, dsRequest)”, _4=>Obj)
DataSource.updateData(_1=>Obj, _2=>“isc_OID_99.$337(dsResponse, dsRequest)”, _3=>Obj)
ListGrid.saveEditedValues(_1=>4, _2=>null, _3=>Obj, _4=>Obj, _5=>“_1”, _6=>“programmatic”, _7=>“this.$335(rowNum,1,colNum,editCompletion…”[54])
ListGrid.saveEdits(_1=>“programmatic”, _2=>“this.$335(rowNum,1,colNum,editCompletion…”[54], _3=>4, _4=>null, _5=>undef)
ListGrid.saveAllEdits(_1=>undef, _2=>undef)
StatefulCanvas.handleActivate(_1=>Obj, _2=>undef)
StatefulCanvas.handleClick(_1=>Obj, _2=>undef)
EventHandler.bubbleEvent(_1=>[Label ID:isc_OID_116], _2=>“click”, _3=>undef, _4=>undef)
EventHandler.handleClick(_1=>[Label ID:isc_OID_116], _2=>undef)
EventHandler.$k5(_1=>Obj{type:error}, _2=>undef)
EventHandler.handleMouseUp(_1=>Obj{type:error}, _2=>undef)
EventHandler.dispatch(_1=>EventHandler.handleMouseUp(), _2=>Obj{type:error})
anonymous(event=>undef)
“var returnVal=arguments.callee.$ch.isc.EH.dispatch(arguments.callee.$j2,event);return returnVal;”

It seems ‘%’ is the only special character that somehow failed the whole thing, I tried others like ‘&’,‘=’,‘/’,‘<’,‘~’ all looks fine.

Has anyone come across similar issue before and have a workaround solution for it? Appreciate any feedback.

Regards,

Eric

What version is this? (always post this)

Just a quick update to let you know we took a look and were not able to reproduce this using the 70RC2 build readily.
If you can let us know what version you’re seeing this on (see evaluation “isc.version” in the dev console to see this), and give us enough sample code to create a test case to demonstrate the problem on our end we’ll be happy to take a deeper look.

(If you can’t put together a working example, if you could include your dataSource definition code, your listGrid code and let us know exactly what edits you’re committing when you see the bug that’d probably be sufficient)

Thanks

Hi,

isc.version is “7.0rc3/LGPL Development Only”, at the footer of the dev console it says ‘SmartClient Version: 7.0rc3 (built 2009-06-21)’

my DataSource definition is

masterDS = new RestDataSource() {   
                protected Object transformRequest(DSRequest dsRequest) {               	
                    	dsRequest.setPrompt(constants.querying());
                        dsRequest.setShowPrompt(false);
                        dsRequest.setParams (paraMap);  
                    	return super.transformRequest(dsRequest);                		
                }   
                ....

dsBindingArray.add(new OperationBinding());
dsBindingArray.get(dsBindingArray.size()-1).setOperationType(DSOperationType.FETCH);
dsBindingArray.get(dsBindingArray.size()-1).setDataProtocol(DSProtocol.POSTMESSAGE);
dsBindingArray.get(dsBindingArray.size()-1).setDataFormat(DSDataFormat.JSON);
dsBindingArray.get(dsBindingArray.size()-1).setDataURL(GWT.getModuleBaseURL()+ "../" + fetchURL);

dsBindingArray.add(new OperationBinding());
dsBindingArray.get(dsBindingArray.size()-1).setOperationType(DSOperationType.UPDATE);
dsBindingArray.get(dsBindingArray.size()-1).setDataProtocol(DSProtocol.POSTMESSAGE);
dsBindingArray.get(dsBindingArray.size()-1).setDataFormat(DSDataFormat.JSON);
dsBindingArray.get(dsBindingArray.size()-1).setDataURL(GWT.getModuleBaseURL()+ "../" + updateURL);

OperationBinding[] dsBinding = new OperationBinding[dsBindingArray.size()];        
dsBindingArray.toArray(dsBinding);       
masterDS.setOperationBindings(dsBinding);       


masterDS.setDataProtocol(DSProtocol.POSTMESSAGE);
masterDS.setDataFormat(DSDataFormat.JSON);
masterDS.setClientOnly(false);

paraMap is HashMap pass parameters to the background servlet for database processsing

ListGrid definition is

masterGrid = new ListGrid();
masterGrid.setDataSource(masterDS);

masterGrid.setWidth100();
masterGrid.setAutoFetchData(false);
masterGrid.setShowSortArrow(SortArrow.FIELD);
masterGrid.setAutoFitMaxRecords(20);
masterGrid.setAlternateRecordStyles(true);
masterGrid.setCanReorderFields(true);
masterGrid.setShowHeaderMenuButton(false);
masterGrid.setShowHeaderContextMenu(true);
	
masterGrid.setCanEdit(true);
masterGrid.setModalEditing(true);
masterGrid.setEditEvent(ListGridEditEvent.DOUBLECLICK); 
masterGrid.setListEndEditAction(RowEndEditAction.NEXT);    			
masterGrid.setAutoSaveEdits(false);

then I have several ListGridField to get the data out of attached DataSource and then call fetchData() to get the data populated to the Grid.

I then created a button to call saveAllEdits() similar to below:

pageSaveLabel.addClickHandler(new ClickHandler()
	{
	public void onClick(ClickEvent event)
	{
		SC.confirm("Save Update?", new BooleanCallback() {

			public void execute(Boolean value) {
				if (value)
					masterGrid.saveAllEdits();
				return;							
			}
		});
	}
});

And then, no repsonse back from server, servlet no being called, and in dev console I can see the error message as described earlier.

The specific data field I am updating through the grid has the value of ‘WINE SPARKLING 200ml 11.5%’, this is fetched to the grid without any problem. But on the update back, it ends up with the error message mentioned earlier. After playing around other characters and do the ascii to see if there is any special hidden character, everything seems to be normal with this particular String.

In dev console, after submit masterGrid.saveAllEdits(), I can see following decoded request in the RPC tab:

{
actionURL:“http://localhost:8080/showcase/../DBUpdate.do”,
showPrompt:false,
prompt:“Updating…”,
transport:“xmlHttpRequest”,
useSimpleHttp:true,
promptStyle:“dialog”,
params:{
objname:“itemlist”
},
httpMethod:“POST”,
sendNoQueue:true,
bypassCache:true,
callback:{
target:null
},
willHandleError:true,
serverOutputAsString:true,
clientContext:{
saveCallback:“this.$335(rowNum,0,colNum,editCompletionEvent,success)”,
newValues:{
item_number:“4B123”,
description:“WINE SPARKLING 150ml 11.5%”
},
editInfo:{
editValuesID:“_1”,
rowNum:1,
colNum:null,
values:‘$$BACKREF$$:.actionURL.showPrompt.prompt.transport.useSimpleHttp.promptStyle.params.httpMethod.sendNoQueue.bypassCache.callback.willHandleError.serverOutputAsString.clientContext.saveCallback.newValues’,
oldValues:{
item_number:“4B123”,
description:“WINE SPARKLING 200ml 11.5%”,
desc2:“WINE SPARKLING 200ml 11.5%”,
create_datetime:new Date(1243561383000)
},
editCompletionEvent:“programmatic”
}
},
data:“{\r "dataSource":"isc_OID_114", \r "operationType":"update", \r "operationId":null, \r "startRow":null, \r "endRow":null, \r "sortBy":null, \r "textMatchStyle":null, \r "componentId":"isc_OID_115", \r "data":{\r "item_number":"4B123", \r "description":"WINE SPARKLING 150ml 11.5%"\r }, \r "oldValues":{\r "item_number":"4B123", \r "description":"WINE SPARKLING 200ml 11.5%", \r "desc2":"WINE SPARKLING 200ml 11.5%", \r "create_datetime":"2009-05-29T01:43:03"\r }\r}”
}

Hi,

Any luck with this issue?
I am a bit surprised if I am the only one having this problem with ‘%’.
I downgraded to rc3, and the problem still persists.
Meanwhile, I decided to workaround this problem by ‘hashing’ ‘%’ characters sent through RPCManager, and it works, as below:

if (dsRequest.getOperationType().equals(DSOperationType.UPDATE))  {
      		JavaScriptObject data = dsRequest.getAttributeAsJavaScriptObject("data");
      		for (int i=0; i < JSOHelper.getProperties(data).length; i++) {
      			if (JSOHelper.getAttribute(data, JSOHelper.getProperties(data)[i]).indexOf("%") > -1)
          		   JSOHelper.setAttribute(data, JSOHelper.getProperties(data)[i], 
          				     JSOHelper.getAttribute(data, 
          				       		  JSOHelper.getProperties(data)[i]).replaceAll("%", "!@#"));                			
      		}
      		dsRequest.setAttribute("oldValues", "");

        	return super.transformRequest(dsRequest);                		
}

Not the perfect solution, but at least gives me what I want.

Regards,

Eric

This should have been hit by dozens of customers whose data has "%"s. You may have some kind of unusual IE plugin creating this issue? Try Firefox on your machine, and perhaps IE on any other machine.