cancel
Showing results for 
Search instead for 
Did you mean: 

Special characters in URL parameters retrieved as question marks

Former Member
0 Kudos

Hello,

I am posting a simple HTML form to a WebDynpro application, and then I retrieve the 2 parameters with the following code :

IWDWebContextAdapter adapter = WDWebContextAdapter.getWebContextAdapter();
String comment= adapter.getRequestParameter("comment");

Problem : some special characters (those with accents for instance) are retrieved as question marks. Their ascii character is always 65533 (unicode rather?).

I guess this is a problem of charset, but where could I change it ?

Trying to encode afterwards does not change the characters, I always get the question marks. But I may not do it the right way...

Any hint on that ?

Thanks a lot.

Best Regards,

Nicolas

Accepted Solutions (0)

Answers (1)

Answers (1)

former_member185029
Active Contributor
0 Kudos

Hi,

refer to following code.

Stop using deprecated object IWDWebContextAdapter

IWDProtocolAdapter adapter = WDProtocolAdapter.getProtocolAdapter();
	
	try {
		byte comment[]= adapter.getRequestObject().getParameter("comment").getBytes("ASCII");
		String str = new String(comment);
	} catch (UnsupportedEncodingException e) {
		// TODO Auto-generated catch block
		e.printStackTrace();
	}

Ashu

Former Member
0 Kudos

Hi,

Thanks Ashu for your answer.

I am working on NW2004 SP19, and I must use IWDWebContextAdapter. Unfortunately IWDProtocolAdapter is unknown in this version.

I tried your code applied to IWDWebContextAdapter, but that does not solve the problem...

Any other hint ?

Nicolas

former_member185029
Active Contributor
0 Kudos

Hi,

try UTF-8 encoding.

Ashu

Former Member
0 Kudos

Hello,

Unfortunately that does not change anything. I always get these question marks, whatever charset I use (ASCII, UTF-8 or ISO-8859-1)...

Looks like the bad conversion is done before, at the adapter level.

Any help greatly appreciated...

Nicolas