From eaee650119873a64543daa998c3db7155ba89401 Mon Sep 17 00:00:00 2001 From: Sergey Vladimirov Date: Thu, 21 Jul 2011 03:33:29 +0000 Subject: [PATCH] add processing of hyphen chars in Word-to-HTML and Word-to-FO converters git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1149020 13f79535-47bb-0310-9956-ffa450edef68 --- .../poi/hwpf/converter/AbstractWordConverter.java | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/src/scratchpad/src/org/apache/poi/hwpf/converter/AbstractWordConverter.java b/src/scratchpad/src/org/apache/poi/hwpf/converter/AbstractWordConverter.java index e3bc643dfe..41533b0082 100644 --- a/src/scratchpad/src/org/apache/poi/hwpf/converter/AbstractWordConverter.java +++ b/src/scratchpad/src/org/apache/poi/hwpf/converter/AbstractWordConverter.java @@ -61,6 +61,10 @@ public abstract class AbstractWordConverter private static final byte SPECCHAR_AUTONUMBERED_FOOTNOTE_REFERENCE = 2; + private static final char UNICODECHAR_NONBREAKING_HYPHEN = '\u2011'; + + private static final char UNICODECHAR_ZERO_WIDTH_SPACE = '\u200b'; + private final Set bookmarkStack = new LinkedHashSet(); private FontReplacer fontReplacer = new DefaultFontReplacer(); @@ -225,6 +229,16 @@ public abstract class AbstractWordConverter } processLineBreak( block, characterRun ); } + else if ( charChar == 30 ) + { + // Non-breaking hyphens are stored as ASCII 30 + stringBuilder.append( UNICODECHAR_NONBREAKING_HYPHEN ); + } + else if ( charChar == 31 ) + { + // Non-required hyphens to zero-width space + stringBuilder.append( UNICODECHAR_ZERO_WIDTH_SPACE ); + } else { stringBuilder.append( charChar ); -- 2.39.5