Search code examples
javascriptjquerycharacter-encodingcordovautf8-decode

How to send form-post with iso-encoding, when no control of server


I'm struggling with encoding issues when i send an Ajax Post to a server from my Phonegap/Html-application with jQuery.

The receiving end-server uses encoding ISO-8859-1, and I have no control over it. Reading the jQuery docs ( http://api.jquery.com/jQuery.ajax/ ) under 'contentType' states

Data will always be transmitted to the server using UTF-8 charset; you must decode this appropriately on the server side.

So are there no way to transmit data from jquery to that url, ut8-decoding it before sending? I have tried decoding the strings with decoders like http://www.navioo.com/javascript/tutorials/Javascript_utf8_decode_1528.html but with no luck.

Thanks for your time, cederlof


Solution

  • A bit dissapointed, but I went with the form-to-iframe solution, and set the accept-charset as stated in Setting the character encoding in form submit for Internet Explorer

    <form accept-charset="ISO-8859-1" ...