Details
-
Bug
-
Resolution: Solved By
-
Major
-
15.4
-
None
-
Unknown
-
N/A
-
N/A
-
Description
Apparently processing a request coming from a form in a resource handler, without using any piece of javascript to submit the form, doesn't allow to properly process the encoding of the request.
In Change Request I had a standard html form such as:
<form id="titleForm" action="/my/resource/handler/url" method="post"> <input type="hidden" name="change" value="settitle"/> <input type="text" id="newTitle" name="newTitle" value="中文"/> <input type="submit" value="Click me"/> </form>
When submitted to the resource handler the value of the newTitle parameter was badly encoded when using tomcat. However, when transforming my code to rely on a piece of jQuery with a script as dumb as:
event.preventDefault(); var actionUrl = $('#titleForm').attr('action'); $.post(actionUrl, { 'changeType': 'settitle', 'new-title': $('input#newTitle').val() }).done(function (data) { console.log(data); });
Then the parameter was properly encoded. Analysis of the request shown that in first case (standard html form) the Content-Type header was application/x-www-form-urlencoded while in second case it was application/x-www-form-urlencoded; charset=UTF-8
Attachments
Issue Links
- relates to
-
XWIKI-21082 Unable to login after setting a new password with non-ascii characters via password reset
- Closed
-
CRAPP-288 Bad encoding when saving title and description
- Closed