diff options
author | Mark Hung <marklh9@gmail.com> | 2016-01-10 00:28:14 +0800 |
---|---|---|
committer | Michael Stahl <mstahl@redhat.com> | 2016-01-14 14:57:07 +0100 |
commit | e99f22bbc499ab0566621ee0bb01e4a7747efe76 (patch) | |
tree | a2eaa8ae508ddc7e13d1e4f39a360a62e92a98b3 /sax | |
parent | 5290bb4d221051b05f6146ddc4bf2a47ba662655 (diff) |
Fix FastSaxSerializer::write() for non-BMP unicode characters.
Reviewed-on: https://gerrit.libreoffice.org/21293
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Michael Stahl <mstahl@redhat.com>
(cherry picked from commit 7ec5ba47783ac8b2d0141109d0efe6b20b363ced)
Signed-off-by: Michael Stahl <mstahl@redhat.com>
Change-Id: I6ee9d028813c970b9ac5b9f0574af932e73111bd
Diffstat (limited to 'sax')
-rw-r--r-- | sax/source/tools/fastserializer.cxx | 25 |
1 files changed, 2 insertions, 23 deletions
diff --git a/sax/source/tools/fastserializer.cxx b/sax/source/tools/fastserializer.cxx index 37ed847c6066..8437ff0284e4 100644 --- a/sax/source/tools/fastserializer.cxx +++ b/sax/source/tools/fastserializer.cxx @@ -94,29 +94,8 @@ namespace sax_fastparser { void FastSaxSerializer::write( const OUString& sOutput, bool bEscape ) { - const sal_Int32 nLength = sOutput.getLength(); - for (sal_Int32 i = 0; i < nLength; ++i) - { - const sal_Unicode cUnicode = sOutput[ i ]; - const char cChar = cUnicode; - if (cUnicode & 0xff80) - { - write( OString(&cUnicode, 1, RTL_TEXTENCODING_UTF8) ); - } - else if(bEscape) switch( cChar ) - { - case '<': writeBytes( "<", 4 ); break; - case '>': writeBytes( ">", 4 ); break; - case '&': writeBytes( "&", 5 ); break; - case '\'': writeBytes( "'", 6 ); break; - case '"': writeBytes( """, 6 ); break; - case '\n': writeBytes( " ", 5 ); break; - case '\r': writeBytes( " ", 5 ); break; - default: writeBytes( &cChar, 1 ); break; - } - else - writeBytes( &cChar, 1 ); - } + write( sOutput.toUtf8(), bEscape ); + } void FastSaxSerializer::write( const OString& sOutput, bool bEscape ) |