[Greasemonkey] Javascript character encoding problem
Jonas Lundberg
my.name.is.hans at gmail.com
Wed Apr 5 01:23:30 EDT 2006
Although this must be a common question, I have not found a good answer to it.
I am posting a form through GM_xmlhttpRequest:
GM_xmlhttpRequest({
function send(data) {
GM_xmlhttpRequest({
method: 'POST',
url: mysubmit,
headers: {
'Content-type': 'multipart/form-data; boundary=shapecms',
},
data: data,
onload: function(responseDetails) {
var ok = '200';
if(responseDetails.status == ok) {
}
// GM_log(responseDetails.responseText);
load(myfrontpath, 'front');
notLoadedFront = 'false';
}
}) };
However, Swedish characters in the "data" variable, are scrambled.
If I look at the data being sent, using the LiveHTTP headers
extension, using a normal submit button all is well:
-----------------------------41184676334
Content-Disposition: form-data; name="titel"
öö
-----------------------------41184676334
However, with GM_xmlhttpRequest I instead get:
-----------------------------41184676334
Content-Disposition: form-data; name="titel"
öö
-----------------------------41184676334
That's not good. What am going wrong here?
I have to use an Ajax call to send the form, because the form is part
of a web sticky notes application (open source), for injecting
discussion forums on web pages.
Regards
Hans
More information about the Greasemonkey
mailing list