ASF Bugzilla – Attachment 23835 Details for
Bug 46610
[PATCH] Problems accessing documents containing unicode
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
unit test case
TestBug46610.java (text/x-java), 1.43 KB, created by
Maxim Valyanskiy
on 2009-06-19 05:53:30 UTC
(
hide
)
Description:
unit test case
Filename:
MIME Type:
Creator:
Maxim Valyanskiy
Created:
2009-06-19 05:53:30 UTC
Size:
1.43 KB
patch
obsolete
>package org.apache.poi.hwpf; > >import junit.framework.TestCase; > >import java.io.FileInputStream; > >import org.apache.poi.hwpf.usermodel.CharacterRun; >import org.apache.poi.hwpf.usermodel.Paragraph; >import org.apache.poi.hwpf.usermodel.Range; > >public class TestBug46610 extends TestCase { > private String dirname; > > protected void setUp() throws Exception { > dirname = System.getProperty("HWPF.testdata.path"); > } > > public void testUtf() throws Exception { > HWPFDocument doc = new HWPFDocument(new FileInputStream(dirname + "/Bug46610_1.doc")); > > runExtract(doc); > } > > public void testUtf2() throws Exception { > HWPFDocument doc = new HWPFDocument(new FileInputStream(dirname + "/Bug46610_2.doc")); > > runExtract(doc); > } > > public void testExtraction() throws Exception { > HWPFDocument doc = new HWPFDocument(new FileInputStream(dirname + "/Bug46610_3.doc")); > > String text = runExtract(doc); > > assertTrue(text.contains("\u0421\u0412\u041e\u042e")); > } > > private String runExtract(HWPFDocument doc) { > StringBuffer out = new StringBuffer(); > > Range globalRange = doc.getRange(); > for (int i = 0; i < globalRange.numParagraphs(); i++) { > Paragraph p = globalRange.getParagraph(i); > out.append(p.text()); > out.append("\n"); > for (int j = 0; j < p.numCharacterRuns(); j++) { > CharacterRun characterRun = p.getCharacterRun(j); > characterRun.text(); > } > } > > return out.toString(); > } >}
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Raw
Actions:
View
Attachments on
bug 46610
:
23178
|
23179
|
23180
|
23181
|
23184
|
23829
|
23833
|
23834
| 23835