johnshih
Members-
Content count
4 -
Joined
-
Last visited
About johnshih
-
Rank
Forum Newbie
-
Cannot display Chinese Character properly
johnshih replied to johnshih's topic in FusionCharts and JSP
thanks Rahul! It works now after add 'UTF-8' to the outstreamwriter. Writer writer = new OutputStreamWriter(outs, "UTF-8"); -
Cannot display Chinese Character properly
johnshih replied to johnshih's topic in FusionCharts and JSP
Hi Rahul, Here is my servlet code. Now it can display the chart, but show '??' for chinese character in both chart label and caption. chartString = createXmlChart(req, res); res.setContentType("text/html; charset=UTF-8"); res.setHeader("Cache-Control", "no-store"); res.setHeader("Pragma", "no-cache"); OutputStream outs = res.getOutputStream(); outs.write(new byte[]{(byte)0xEF, (byte)0xBB, (byte)0xBF}); outs.flush(); Writer writer = new OutputStreamWriter(outs); writer.append(chartString); writer.flush(); writer.close(); where createXmlChart(req, res) will create xml chart string like - <chart bgColor="FFFFFF" bgAlpha="100" caption="????????" is2D="1" isSliced="1" showPlotBorder="1" plotBorderThickness="1" plotBorderAlpha="100" plotBorderColor="FFFFFF" numberPrefix="" enableSmartLabels="1"> <set label="??" value="14" /> <set label="??" value="14" /> <set label="??" value="9" /> - <styles> - <definition> <style type="font" name="captionFont" size="10" /> <style type="shadow" name="myShadow" /> </definition> - <application> <apply toObject="CAPTION" styles="captionFont" /> <apply toObject="DATAPLOT" styles="myShadow" /> </application> </styles> </chart> -
Cannot display Chinese Character properly
johnshih replied to johnshih's topic in FusionCharts and JSP
Hi, It does not work after put your code to my servler. Below is error shown. Info: Chart loaded and initialized. Initial Width: 220 Initial Height: 150 Scale Mode: noScale Debug Mode: Yes Application Message Language: EN Version: 3.0.2 Chart Type: Pyramid Chart Chart Objects: BACKGROUND CANVAS CAPTION SUBCAPTION DATALABELS DATAPLOT TOOLTIP INFO: Chart registered with external script. DOM Id of chart is myChartId INFO: XML Data provided using dataURL method. dataURL provided: /dwfmgz/servlet/MapChartServlet?chart=1 dataURL provided: /dwfmgz/servlet/MapChartServlet?chart=1 INFO: XML Data provided using dataURL method. ERROR: Invalid XML encountered. An XML element is malformed. Click the above "dataURL Invoked" link to see the XML in browser. -
Hi, I shall be happy if anyone can help me resolve below wired character problem. Below is my javascript, xml and screenshot. javascript: <script language="JavaScript"> var myChart = new FusionCharts("../swf/Pyramid.swf", "myChartId", "220", "150", "0", "1"); myChart.setDataURL("<%=request.getContextPath()%>/servlet/MapChartServlet?chart=1&deptid="); myChart.render("div_chart"); </script> xml: (xml is generated and returned from my servlet) <chart bgColor='FFFFFF' bgAlpha='100' caption='???????:?????' is2D='1' isSliced='1' showPlotBorder='1' plotBorderThickness='1' plotBorderAlpha='100' plotBorderColor='FFFFFF' numberPrefix='' enableSmartLabels='1' ><set label='OFFLINE' value='7' /><styles><definition><style type='font' name='captionFont' size='10' /><style type='shadow' name='myShadow' /><style type='font' name='TOOLTIP' size='8' /></definition><application><apply toObject='CAPTION' styles='captionFont' /><apply toObject='DATAPLOT' styles='myShadow' /><apply toObject='TOOLTIP' styles='tooltipFont' /></application></styles></chart> screenshot