Jump to content


Japanese Language In Fusionchart


  • Please log in to reply
7 replies to this topic

#1 Gowrishankar

Gowrishankar

    Forum Newbie

  • Members
  • 4 posts

Posted 13 December 2011 - 10:46 AM

Hi,
Follwoing is the code I used for showing Japanese Chnaracters in Fusionchart. (My XML contains Japanese characters)


OutputStream out = response.getOutputStream();
outs.write( new byte[]{(byte)0xEF, (byte)0xBB, (byte)0xBF} );
out.write(xmlDoc.getBytes());
out.flush();
out.close();


Also Tried follwoign one
PrintStream ps = new PrintStream(response.getOutputStream(), true, "UTF-8"); 
ps.print(new byte[]{(byte)0xEF, (byte)0xBB, (byte)0xBF});
ps.println(xmlDoc);
ps.close();


for these 2 code the result is coming as the "pict1.jsp" chart.

Now I tried in stanalone HTML file using ASCII code for the japanese characters (amp;#24215;amp;#33303; is correspondind ASCII code for my Japanese character).
This gives me the "pict2.jsp" chart

In both the cases the actual japanese character is not showing.

please advice me further for fixing this issue.

Attached Thumbnails

  • pict1.JPG
  • pict2.JPG

Edited by Gowrishankar, 13 December 2011 - 11:09 AM.


#2 Angshu

Angshu

    Supreme Being

  • Administrators
  • 3222 posts

Posted 13 December 2011 - 10:56 AM

Hi,

Welcome to FusionCharts Forum! Posted Image

To use multi-lingual characters on the chart, you necessarily need to use UTF-8 encoded XML. More importantly, the XML file/stream does require a BOM stamp to be present as the very first 3 Bytes of the file. Hence, one must remember the two basic thumb rules :

for dataURL method - the XML file/stream should be having the BOM stamp and

for dataXML method - the HTML/application file containing the XML as well as the chart SWF should have the BOM stamp.

What is BOM - Byte Order Mark. It is 'EF BB EF' - these 3 bytes in case of UTF-8 encoded files, the BOM being placed at the very beginning of the file. It is an indicator that the file is containing UTF-8 encoded strings.

For more details and sample example, please visit the links below:

http://docs.fusionch...ars/SpChar.html

http://docs.fusionch...TF8Example.html

Hope this helps.
Help us improve our documentation with your precious feedback at:

[url="http://documentation-survey.g.fusioncharts.com/"][url][url]http://documentation...sioncharts.com/[/url][/url][/url]

Best,

Angshu

[url="http://twitter.com/fusioncharts"]Follow us on @Twitter[/url]



#3 Gowrishankar

Gowrishankar

    Forum Newbie

  • Members
  • 4 posts

Posted 13 December 2011 - 11:02 AM

Hi Angshu,
Thanks for ur quick response. I didnt expect ur reply that fast :) (Still i was editing my post)

Actually if you see the my first code sinpet i was using exactly the idea given in the url "http://docs.fusionch...ars/SpChar.html" you mentioned.

But still it didnt work.





#4 Angshu

Angshu

    Supreme Being

  • Administrators
  • 3222 posts

Posted 13 December 2011 - 11:09 AM

Hi,

Thanks for your response.

Please refer to the link: http://docs.fusionch...TF8Example.html

The above link has an example of using Japanese character with JSP.

Hope this helps.
Help us improve our documentation with your precious feedback at:

[url="http://documentation-survey.g.fusioncharts.com/"][url][url]http://documentation...sioncharts.com/[/url][/url][/url]

Best,

Angshu

[url="http://twitter.com/fusioncharts"]Follow us on @Twitter[/url]



#5 Gowrishankar

Gowrishankar

    Forum Newbie

  • Members
  • 4 posts

Posted 13 December 2011 - 12:47 PM

Thanks Angshu for the example, will try it and let you konw.

#6 Angshu

Angshu

    Supreme Being

  • Administrators
  • 3222 posts

Posted 13 December 2011 - 12:53 PM

Hi,

Thanks for your response.

Looking forward to your feedback.
Help us improve our documentation with your precious feedback at:

[url="http://documentation-survey.g.fusioncharts.com/"][url][url]http://documentation...sioncharts.com/[/url][/url][/url]

Best,

Angshu

[url="http://twitter.com/fusioncharts"]Follow us on @Twitter[/url]



#7 Gowrishankar

Gowrishankar

    Forum Newbie

  • Members
  • 4 posts

Posted 19 December 2011 - 07:14 AM

Hi,
After some try we got it working. below code works fine.

response.setContentType("text/xml; characterset=utf-8");
response.setCharacterEncoding("UTF-8");
OutputStream outs = response.getOutputStream();
outs.write( new byte[]{(byte)0xEF, (byte)0xBB, (byte)0xBF} );


outs.write(xmlDoc.getBytes("UTF-8"));


outs.flush();

Apart from putting
outs.write( new byte[]{(byte)0xEF, (byte)0xBB, (byte)0xBF} );
as mentioned in fusion code sample (thanks to Angshu for the link), need to mention "UTF-8" for the getBytes() method.
It worked fine after that.

Edited by Gowrishankar, 19 December 2011 - 07:15 AM.


#8 Angshu

Angshu

    Supreme Being

  • Administrators
  • 3222 posts

Posted 19 December 2011 - 10:40 AM

Hi,

Glad to know that you have managed to resolve your problem.

Happy FusionCharting!!! Posted Image
Help us improve our documentation with your precious feedback at:

[url="http://documentation-survey.g.fusioncharts.com/"][url][url]http://documentation...sioncharts.com/[/url][/url][/url]

Best,

Angshu

[url="http://twitter.com/fusioncharts"]Follow us on @Twitter[/url]