Date: prev next · Thread: first prev next last
2010 Archives by date, by thread · List index


On Tue, 2010-11-30 at 10:36 -0500, Joe Smith wrote:
Can someone running LibO on Fedora try and reproduce this bug:

document hyperlink with utf-8 characters fails export to PDF
http://qa.openoffice.org/issues/show_bug.cgi?id=115788

So far no one else can reproduce it.

I can.  Its a problem in vcl/source/gdi/pdfwriter_impl.cxx and
DECODE_WITH_CHARSET.

We now always write as US_ASCII to pdf now, which is one change from
3.2.1, so pretty much anything with DECODE_WITH_CHARSET in that file is
very dubious unfortunately.

The attached two alternative fixes would fix it for me. Either don't
decode URIs and leave %XX in them (This might adversely affect the
"Launch" target, whatever that exactly does in PDF), or assume that we
can write as UTF-8 always. Probably need to go read the pdf spec to see
what's the correct option here.

C.
diff --git a/vcl/source/gdi/pdfwriter_impl.cxx b/vcl/source/gdi/pdfwriter_impl.cxx
index b3679aa..693d8ef 100644
--- a/vcl/source/gdi/pdfwriter_impl.cxx
+++ b/vcl/source/gdi/pdfwriter_impl.cxx
@@ -4665,7 +4667,7 @@ we check in the following sequence:
 //substitute the fragment
                         aTargetURL.SetMark( aLineLoc.getStr() );
                     }
-                    rtl::OUString aURL = aTargetURL.GetMainURL( (nSetRelative || eTargetProtocol 
== INET_PROT_FILE) ? INetURLObject::DECODE_WITH_CHARSET : INetURLObject::NO_DECODE );
+                    rtl::OUString aURL = aTargetURL.GetMainURL( INetURLObject::NO_DECODE );
 // check if we have a URL available, if the string is empty, set it as the original one
 //                 if( aURL.getLength() == 0 )
 //                     appendLiteralStringEncrypt( rLink.m_aURL , rLink.m_nObject, aLine );
diff --git a/vcl/source/gdi/pdfwriter_impl.cxx b/vcl/source/gdi/pdfwriter_impl.cxx
index b3679aa..bc4ecca 100644
--- a/vcl/source/gdi/pdfwriter_impl.cxx
+++ b/vcl/source/gdi/pdfwriter_impl.cxx
@@ -69,6 +69,8 @@
 #include <icc/sRGB-IEC61966-2.1.hxx>
 #include <vcl/lineinfo.hxx>
 
+#include <stdio.h>
+
 using namespace vcl;
 using namespace rtl;
 
@@ -2008,7 +2010,7 @@ inline void PDFWriterImpl::appendLiteralStringEncrypt( const rtl::OString& 
rInSt
 
 inline void PDFWriterImpl::appendLiteralStringEncrypt( const rtl::OUString& rInString, const 
sal_Int32 nInObjectNumber, rtl::OStringBuffer& rOutBuffer )
 {
-    rtl::OString aBufferString( rtl::OUStringToOString( rInString, RTL_TEXTENCODING_ASCII_US ) );
+    rtl::OString aBufferString( rtl::OUStringToOString( rInString, RTL_TEXTENCODING_UTF8 ) );
     appendLiteralStringEncrypt( aBufferString, nInObjectNumber, rOutBuffer);
 }
 

Context


Privacy Policy | Impressum (Legal Info) | Copyright information: Unless otherwise specified, all text and images on this website are licensed under the Creative Commons Attribution-Share Alike 3.0 License. This does not include the source code of LibreOffice, which is licensed under the Mozilla Public License (MPLv2). "LibreOffice" and "The Document Foundation" are registered trademarks of their corresponding registered owners or are in actual use as trademarks in one or more countries. Their respective logos and icons are also subject to international copyright laws. Use thereof is explained in our trademark policy.