Index: sw/source/filter/html/htmlatr.cxx
===================================================================
--- sw/source/filter/html/htmlatr.cxx (revision 1362330)
+++ sw/source/filter/html/htmlatr.cxx (working copy)
@@ -2628,7 +2628,22 @@
if( bOutChar )
{
- sal_Unicode c = rStr.GetChar( nStrPos );
+ sal_uInt64 c = rStr.GetChar( nStrPos );
+ //For bug 120442, if the unicode is equal or larger than 0xd800 and smaller equal or than 0xdbff,
+ //and the next unicode is equal or larger then 0xdc00 and equal or smaller than 0xdfff,
+ //need to convert two 16-bit unicode to a 32-bit unicode to show the content.
+ if( nStrPos < nEnde - 1 )
+ {
+ sal_Unicode d = rStr.GetChar( nStrPos + 1 );
+ if ( c >= 0xd800 && c <= 0xdbff && d >= 0xdc00 && d <= 0xdfff)
+ {
+ sal_uInt64 templow = d&0x03ff;
+ sal_uInt64 temphi = ((c&0x03ff) + 0x0040)<<10;
+ c = temphi|templow;
+ nStrPos++;
+ }
+ }
+
// versuche nach ungefaehr 255 Zeichen eine neue Zeile zu
// beginnen, aber nicht in PRE und nur bei Spaces
if( ' '==c && !rHTMLWrt.nLastParaToken )
@@ -2662,8 +2677,16 @@
HTMLOutFuncs::FlushToAscii( rWrt.Strm(), aContext );
HTMLOutFuncs::Out_AsciiTag( rWrt.Strm(), OOO_STRING_SVTOOLS_HTML_linebreak );
}
+ //For bug 120442, if c is larger than 0xffff, means it is a 32-bit unicode, so output it stream as "******;"
+ else if( c > 0xffff)
+ {
+ ByteString sOut("");
+ (((sOut += '&') += '#') +=
+ ByteString::CreateFromInt64( (sal_uInt64)c )) += ';';
+ rWrt.Strm() << sOut.GetBuffer();
+ }
else
- HTMLOutFuncs::Out_Char( rWrt.Strm(), c, aContext, &rHTMLWrt.aNonConvertableCharacters );
+ HTMLOutFuncs::Out_Char( rWrt.Strm(), (sal_Unicode)c, aContext, &rHTMLWrt.aNonConvertableCharacters );
// Wenn das letzte Zeichen eines Absatzed ein harter
// Zeilen-Umbruch ist brauchen wir noch ein
mehr, weil