Author: kiwiwings
Date: Tue May 2 23:30:17 2017
New Revision: 1793601
URL: http://svn.apache.org/viewvc?rev=1793601&view=rev
Log:
Reverted DocumentSummary hack in codepage guessing code
Modified:
poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/HWPFOldDocument.java
Modified: poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/HWPFOldDocument.java
URL:
http://svn.apache.org/viewvc/poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/HWPFOldDocument.java?rev=1793601&r1=1793600&r2=1793601&view=diff
==============================================================================
--- poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/HWPFOldDocument.java
(original)
+++ poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/HWPFOldDocument.java Tue
May 2 23:30:17 2017
@@ -198,36 +198,7 @@ public class HWPFOldDocument extends HWP
* @return The detected Charset from the old font table
*/
private Charset guessCodePage(OldFontTable fontTable) {
- //try to get it out of the overall document summary information
- DocumentSummaryInformation summaryInformation =
getDocumentSummaryInformation();
- if (summaryInformation != null) {
- CustomProperties customProperties =
summaryInformation.getCustomProperties();
- if (customProperties != null) {
- int codePage = customProperties.getCodepage();
- if (codePage > -1) {
- try {
- return
Charset.forName(CodePageUtil.codepageToEncoding(codePage));
- } catch (UnsupportedEncodingException e) {
- //swallow
- }
- }
- }
- //If that didn't work, for now, try to get first valid code page
in a valid section
- for (Section section : summaryInformation.getSections()) {
- if (section.getOffset() < 0) {
- continue;
- }
- int codePage = section.getCodepage();
- if (codePage > -1) {
- try {
- return
Charset.forName(CodePageUtil.codepageToEncoding(codePage));
- } catch (UnsupportedEncodingException e) {
- //swallow
- }
- }
- }
- }
- //if that still doesn't work, pick the first non-default, non-symbol
charset
+ // pick the first non-default, non-symbol charset
for (OldFfn oldFfn : fontTable.getFontNames()) {
HwmfFont.WmfCharset wmfCharset =
HwmfFont.WmfCharset.valueOf(oldFfn.getChs()& 0xff);
if (wmfCharset != null &&
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]