Tag: character encoding

spring mvc jquery ajax响应为json编码问题

Recenlty我在服务器的JSON响应中遇到波兰字符的大问题。 我有简单的Ajax请求: jQuery.ajax( “/GetSimpleRuleList”, { type:”GET”, responseType:”application/json;charset=utf-8″, contentType:”application/json;charset=utf-8″, cache:false } ).done( function ( data ) { console.log( data ); //nevermind here } ); 服务器端的适当控制器: @RequestMapping(value = “/GetSimpleRuleList”, method = RequestMethod.GET) public @ResponseBody String getRuleList( ServletResponse response ) { //magically getting my list here response.setCharacterEncoding( “UTF-8” ); return //Using JACKSON ObjectWriter here } 现在我100%确定服务器端和数据库中的encoidng从中获取数据是好的,没问题。 但是当谈到从服务器读取响应时,它是: ??? […]

Jquery忽略编码ISO-8859-1

我有一个网站,它从字符串中删除正确的编码(ISO-8859-1)并发送错误。 我在我的HTML中指定了此编码 我通过加载我的JavaScript <script type="text/javascript" charset="ISO-8859-1" src="… 我通过JQuery Ajax Request发送信息(带有德语特殊字符’ö’和’ä’): $.ajax({ url: ‘..’, type: ‘POST’, contentType: ‘application/xml;charset=ISO-8859-1’, data: xmlRequest.html(),… 这被转换为请求,在Chrome开发人员工具中,我在Request Header中看到了这一点: .. Content-Type: application/xml;charset=UTF-8 .. 那里发生了什么? 当然特殊字符编码错误(“¶”而不是“ö”)服务器无法理解我,我得到一个错误。