From 0d5e5b951954ea706780546c29cfbd0687f752b7 Mon Sep 17 00:00:00 2001 From: Dirk Mueller Date: Tue, 27 Nov 2007 14:37:31 +0000 Subject: [PATCH] filter out non-ascii stuff from title tag svn path=/branches/KDE/3.5/kdegraphics/kpdf/; revision=742212 --- core/generator_pdf/generator_pdf.cpp | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/core/generator_pdf/generator_pdf.cpp b/core/generator_pdf/generator_pdf.cpp index 103d963ea..8e23f089a 100644 --- a/core/generator_pdf/generator_pdf.cpp +++ b/core/generator_pdf/generator_pdf.cpp @@ -455,11 +455,18 @@ bool PDFGenerator::print( KPrinter& printer ) { pstitle = m_document->currentDocument().fileName( false ); } - QCString pstitle8Bit = pstitle.local8Bit(); + // this looks non-unicode-safe and it is. anything other than ASCII is not specified + // and some printers actually stop printing when they encounter non-ASCII characters in the + // Postscript %%Title tag + QCString pstitle8Bit = pstitle.latin1(); const char* pstitlechar; if (!pstitle.isEmpty()) { pstitlechar = pstitle8Bit.data(); + for (unsigned char* p = (unsigned char*) pstitle8Bit.data(); *p; ++p) + if (*p >= 0x80) + *p = '?'; + printer.setDocName(pstitle); } else