2006 IR Open Discussion Posted August 28, 2006 Share Posted August 28, 2006 By: Vyacheslav Pedak - pedak Problem with russian encoding 2002-12-09 10:58Hi, Seems there is a bug in iReport. I need to create report with russian text. I selected UTF-8 encoding for XML file (report) and wrote text in russian in iReport. In result I received XML file with text in russian encoding (Cp1251) inside, but it must be in UTF-8 (because xerces will read text as UTF-8 not as Cp1251) By: Giulio Toffoli - gt78 RE: Problem with russian encoding 2002-12-09 13:13The unicode problem is the must hard to solve for me because as italian I use always a Latin charset and I don't have more expereince in use cyrillic, russian, chinese, .... characters. However I very interested to solve this problem. Could you send me an russian XML? When you select UTF-8 encoding, iReport don't performe a convertion from an encoding type into another, but it simply write the encoding attribute at the begin of xml file. Giulio By: Vyacheslav Pedak - pedak RE: Problem with russian encoding 2002-12-10 10:45I will send russian XML to you by email. But really it is very easy to solve this problem. You use PrintWriter to write to file: java.io.PrintWriter pw = new java.io.PrintWriter( new java.io.FileOutputStream( filename )); you should use such construction to output text to file in UTF-8: PrintWriter pw = new PrintWriter( new OutputStreamWriter( new FileOutputStream( filename), "UTF8")); In result all data will be written in UTF-8 automatically P.S. Thank you for your software, I find it very useful. So I am ready to help with encoding problems you will have. Feel free to contact me. By: Giulio Toffoli - gt78 RE: Problem with russian encoding 2002-12-11 00:44Thanks! Giulio By: Trung Nhut Tran - nhuttrung RE: Problem with russian encoding 2002-12-22 19:43I have the same problem in Vietnamese. And what is the default font for new report elements? nhuttrung By: Giulio Toffoli - gt78 RE: Problem with russian encoding 2002-12-23 06:13Trung Nhut Tran, could yue send me a Vietnamese xml? Thanks. Giulio By: Trung Nhut Tran - nhuttrung RE: Problem with russian encoding 2002-12-25 19:27I solved the it. For Vietnamese in StaticText, the PDF output is not as expected. The problem is on SAXParser I think. I modified IReportCompiler.java as follow: // NOT WORK for Unicode data in StaticText // JasperCompileManager.compileReportToFile(srcFileName, fileName); FileInputStream fis = null; try{ fis = new FileInputStream(srcFileName); }catch(FileNotFoundException ex){ System.out.println("File not found " +srcFileName); return; } jReport = JasperCompileManager.compileReport(fis); ... print = dori.jasper.engine.JasperFillManager.fillReport(jReport, null, new JRResultSetDataSource(rs)); For your references, I will send you a simple Vietnamese XML file. Thank you for the good tools, NhutTrung Link to comment Share on other sites More sharing options...
vichandoko Posted January 11, 2007 Share Posted January 11, 2007 Hi, I am required to do vietnamese letter on PDF report.Would appreciate if you are able to send me a sample. I tried out the sample from JasperReport documentation. But have the following question:- How should the text be written in unicode or?<textFieldExpression class="java.lang.String"><![CDATA["u0032"]]></textFieldExpression>- How to decide which .TTF to use? Thanks much. Veny 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