Skip to content

Commit de42a30

Browse files
committed
Correctly handle default encoding.
1 parent 823ca9a commit de42a30

File tree

4 files changed

+15
-1
lines changed

4 files changed

+15
-1
lines changed

RTF Parser Kit/src/com/rtfparserkit/parser/standard/ParserState.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ public ParserState(ParserState state)
3535
}
3636

3737
public int currentFont;
38-
public String currentEncoding;
38+
public String currentEncoding = Encoding.ANSI_ENCODING;
3939
public String currentFontEncoding;
4040
public int unicodeAlternateSkipCount = 1;
4141
}

RTF Parser Kit/test/com/rtfparserkit/parser/standard/StandardRtfParserTest.java

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,12 @@ public void testEncodingParse() throws Exception
2929
TestUtilities.assertRtfParserDumpMatches(this, new StandardRtfParser(), "testEncodingParse");
3030
}
3131

32+
@Test
33+
public void testDefaultEncodingParse() throws Exception
34+
{
35+
TestUtilities.assertRtfParserDumpMatches(this, new StandardRtfParser(), "testDefaultEncodingParse");
36+
}
37+
3238
@Test
3339
public void testStylesParse() throws Exception
3440
{
Binary file not shown.
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<rtf>
3+
<group>
4+
<command name="rtf" parameter="1"/>
5+
<chars>Test1</chars>
6+
<command name="par"/>
7+
</group>
8+
</rtf>

0 commit comments

Comments
 (0)