jquery - How to load ISO-8859-1 content via AJAX in jQueryMobile 1.3.1 with correct character encoding? -


i have got php script (cms) generates iso-8859-1 content (in background there database latin1 data). visualize data on mobile devices use jquery mobile 1.3.1. in general there no problem character encoding if use correct meta tag in html:

<meta charset="iso-8859-1" /> 

however jquery mobile has got default setting:

$.mobile.ajaxenabled = true; 

so jquery mobile automatically handle link clicks , form submissions through ajax, when possible.

this smart feature, destroys special characters german umlaute , nasty characters: �

the problem jquery mobile 1.3.1 uses on default utf-8 on ajax requests. there different solutions solve problem:

  1. disable ajax specific links, redirect content special characters:

    data-ajax="false" 
  2. turn off ajax preloading feature:

    $.mobile.ajaxenabled = false; 
  3. follow recommendation , manually set correct content type , override mime type:

    $.ajaxsetup({   contenttype: 'application/x-www-form-urlencoded; charset=iso-8859-1',   beforesend: function(jqxhr) {     jqxhr.overridemimetype('application/x-www-form-urlencoded; charset=iso-8859-1');   } }); 

the last solution did work me.


Comments

Popular posts from this blog

linux - Does gcc have any options to add version info in ELF binary file? -

android - send complex objects as post php java -

charts - What graph/dashboard product is facebook using in Dashboard: PUE & WUE -