PDA

View Full Version : javascript pass Chinese characters fails



bhomass
12 Aug 2012, 10:23 AM
I generated a javascript code which is called from the brwoser.

When I check inside the IDE, everything looks good

var LeftBarcoalHtml = new Ext.ux.Html({
width:60,
value: '??',
name: 'LeftBar_coal',
id: 'home_LeftBar_coal_id'
});

but when it arrived FF, the display becomes '? ?". I used Firebug to take a look at the javascript, it says

var LeftBarcoalHtml = new Ext.ux.Html({
width:60,
value: '? ?',
name: 'LeftBar_coal',
id: 'home_LeftBar_coal_id'
});

I tried playing with view -> character encoding -> Chinese Simplified (GB2312), but made no difference.

Is there something you need to declare to make the Chinese char show up in the browser properly?

sword-it
13 Aug 2012, 4:45 AM
Hi

did you add encoding your page's head section ;



<meta http-equiv="Content-Type" content="text/html; charset=GB2312" />

Regards

bhomass
13 Aug 2012, 5:36 PM
hey, I found it.

I had to declare charset in the servlet response.

resp.setContentType("text/xml; charset=GBK");