jasperNoob Posted March 13, 2007 Share Posted March 13, 2007 Plzzz...Someone plz give me a clue .... any clue....how to print chinese characters in jasper reports .... moderators pour some help .... i have looked through practically the whole forum now for help .... the documentation isnt much help either .... here's what I have done till now I managed to print chinese characters in my report by using unicode codes in the resource bundle.eg:if I want to translate "king" into chinese ill putking= u4E07u3E82uxxxxxxxxsth like this in my resource bundle.It works and prints the chinese characters for those codes. But I have to find out the unicode codes and put them in the resource bundle for this. I want to be able to directly copy paste the chinese characters for king into the resource bundle. Can this be done?? Also tell me if thr's any other way of going abt doing internationalization of double byte charaters thanks in advancePost edited by: jasperNoob, at: 2007/03/13 05:09 Link to comment Share on other sites More sharing options...
lovetide Posted March 13, 2007 Share Posted March 13, 2007 If you use iReport to design your report, you can type/input or copy/paste Chinese characters directly. But if you use resource bundle to store Chinese characters, I have a experience like the following: 1. type/input or copy/paste Chinese characters directly in your .properties file#example:chinese_surname.king=金chinese_surname.liu=刘 2. save .properties file in UTF-8 or GB18030/GBK/GB2312 or BIG5 encoding as you need 3. after you readed from .properties file, convert the encoding of result string from "ISO-8859-1" to the encoding you choosed at step 2, then, you'll get what you want I think... :laugh: Link to comment Share on other sites More sharing options...
jasperNoob Posted March 14, 2007 Author Share Posted March 14, 2007 thanks a lot for the help ... I'll try these immediately ... hope it works out :) Link to comment Share on other sites More sharing options...
jasperNoob Posted March 14, 2007 Author Share Posted March 14, 2007 lovetide wrote:If you use iReport to design your report, you can type/input or copy/paste Chinese characters directly. But if you use resource bundle to store Chinese characters, I have a experience like the following: 1. type/input or copy/paste Chinese characters directly in your .properties file#example:chinese_surname.king=金chinese_surname.liu=刘2. save .properties file in UTF-8 or GB18030/GBK/GB2312 or BIG5 encoding as you need3. after you readed from .properties file, convert the encoding of result string from "ISO-8859-1" to the encoding you choosed at step 2, then, you'll get what you want I think...:laugh: Well I did steps 1 and 2 .... still doesnt work :( I put the translations directly in the properties file and saved the file with UTF-8 encoding . Also tried the "unicode" encoding that's available with notepad. Didnt work with that either. I cudnt implement the 3rd step you mentioned. Bcos I dont know what u mean by changing the encoding of the result string. how do you do that? I am attaching the jrxml here if you would like to take a look. And in the properties file I just wrote vars1=出货信æ¯å’Œå›½é™…出货vars2=金vars3=刘 [file name=chinese.jrxml size=8939]http://www.jasperforge.org/components/com_joomlaboard/uploaded/files/chinese.jrxml[/file] Link to comment Share on other sites More sharing options...
lovetide Posted March 15, 2007 Share Posted March 15, 2007 try to replace $R(vars1) with new String($R{vars1}.getBytes("ISO-8859-1"),"UTF-8"):laugh: Link to comment Share on other sites More sharing options...
jasperNoob Posted March 15, 2007 Author Share Posted March 15, 2007 Loads of thanks.... It is working fine :laugh: Link to comment Share on other sites More sharing options...
jasperNoob Posted March 21, 2007 Author Share Posted March 21, 2007 Now the chinese characters are showing up fine.... but only when I open the Report in HTML output .... If I try a PDF output, a blank page is thrown up. If someone cud help make it work in PDF too, it wud be totally awesome :laugh: thanks Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now