From 484f7292f050904b7964bee14f7ef13f8f377318 Mon Sep 17 00:00:00 2001 From: David Kastrup Date: Mon, 25 Feb 2013 11:17:02 +0100 Subject: [PATCH] Issue 2985: lilypond: Umlauts and other special characters incorrectly exported to PDF meta data Since recent versions of GhostScript are more likely to get along with UTF-16BE rather than ISO-8859-1 for PDF meta strings, we just escalate straight from ASCII to UTF16-BE. --- lily/pdf-scheme.cc | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/lily/pdf-scheme.cc b/lily/pdf-scheme.cc index 1801ae286d..544ce97461 100644 --- a/lily/pdf-scheme.cc +++ b/lily/pdf-scheme.cc @@ -36,10 +36,25 @@ LY_DEFINE (ly_encode_string_for_pdf, "ly:encode-string-for-pdf", char const *charset = "UTF-8"; // Input is ALWAYS UTF-8! gsize bytes_written = 0; +#if 0 + /* First, try to convert to ISO-8859-1 (no encodings required). This will * fail, if the string contains accented characters, so we do not check * for errors. */ g = g_convert (p, -1, "ISO-8859-1", charset, 0, &bytes_written, 0); + +#else + + /* In contrast to the above comment, we do _not_ try full ISO-8859-1 + * since a number of Ghostscript versions fail to properly convert + * this into PDF. UTF-16BE, in contrast, works better with recent + * versions of Ghostscript. + */ + + g = g_convert (p, -1, "ASCII", charset, 0, &bytes_written, 0); + +#endif + /* If that fails, we have to resolve to full UTF-16BE */ if (!g) { -- 2.39.5