I’m programming some websites with JSP-Scripting and I encounterd a strange problem with urlencoded web-formular parameters. The site itself is encoded in iso-8859-1.
I have a simple webform with a field called description.
If I enter german Umlauts or specialchars like “ü” or “ß”, these get automatically urlencoded. But if I want to read this parameter, I always get null.
String description = request.getParameter("description");
If I enter some chinese words, like 專業人士, they are urlencoded, too. However, I can read them without retrieving null.
This behaviour doesn’t change whether I use “post” or “get” as method.
I tried to “pimp” my webform with the text below – but that didn’t help either.
accept-charset="ISO-8859-1" enctype="application/x-www-form-urlencoded"
My question is:
Why can’t I retrieve urlencoded german Umlauts but some chinese words?
Chinese with ISO-8859-1 wont’t work, but german should. If chineese is encoded anyway, maybe your form is encoded in UTF-8? Which browser so you use? What is the encopding of the JSP? You should always use UFT-8, not Latin 1. Nowadays every browser and server should support UTF-8 on every OS.
My experience is, that GET ist often not working with encoding, but POST should do. The form parameters accept-charset and enctype are correct. What server do you use?
The JSP content type is typically set by: