summaryrefslogtreecommitdiff
path: root/utils/HtmlFonts.h
diff options
context:
space:
mode:
authorSteven Murdoch <Steven.Murdoch@cl.cam.ac.uk>2011-06-20 23:25:43 +0100
committerAlbert Astals Cid <aacid@kde.org>2011-06-20 23:25:43 +0100
commitc5601bde9d8f3f56e558a6f63e563c9d337810eb (patch)
tree77122f5df0950e4ab6dea68dbbd655d8982737c6 /utils/HtmlFonts.h
parentd4af1c4ef46abf1f11b7215c7b144ce7bb7912eb (diff)
Fix encoding of PDF document metadata in output of pdftohtml
pdftohtml simply copies the PDF document title into the <title> HTML tag, which fails when the title is UCS-2 encoded, or if it contains characters which are in pdfDocEncoding (a ISO 8859-1 superset), but not in ISO 8859-1. This patch fixes the problem by decoding UCS-2 or pdfDocEncoding into Unicode, then encoding this in the desired output encoding. HTML escaping wasn't being done either, so I have used the existing function HtmlFont::HtmlFilter to perform both HTML escaping and character set encoding. This static method had to be made public to call it from pdftohtml. See bug #37900.
Diffstat (limited to 'utils/HtmlFonts.h')
-rw-r--r--utils/HtmlFonts.h3
1 files changed, 2 insertions, 1 deletions
diff --git a/utils/HtmlFonts.h b/utils/HtmlFonts.h
index a0ca78ab..2cdea4bd 100644
--- a/utils/HtmlFonts.h
+++ b/utils/HtmlFonts.h
@@ -19,6 +19,7 @@
//
// Copyright (C) 2010 OSSD CDAC Mumbai by Leena Chourey (leenac@cdacmumbai.in) and Onkar Potdar (onkar@cdacmumbai.in)
// Copyright (C) 2010 Albert Astals Cid <aacid@kde.org>
+// Copyright (C) 2011 Steven Murdoch <Steven.Murdoch@cl.cam.ac.uk>
//
// To see a description of the changes please see the Changelog file that
// came with your tarball or type make ChangeLog if you are building from git
@@ -65,7 +66,6 @@ class HtmlFont{
static GooString *DefaultFont;
GooString *FontName;
HtmlFontColor color;
- static GooString* HtmlFilter(Unicode* u, int uLen); //char* s);
public:
HtmlFont(){FontName=NULL;};
@@ -84,6 +84,7 @@ public:
GooString* getFontName();
static GooString* getDefaultFont();
static void setDefaultFont(GooString* defaultFont);
+ static GooString* HtmlFilter(Unicode* u, int uLen); //char* s);
GBool isEqual(const HtmlFont& x) const;
GBool isEqualIgnoreBold(const HtmlFont& x) const;
static GooString* simple(HtmlFont *font, Unicode *content, int uLen);