diff options
author | rootavish <[email protected]> | 2014-08-11 06:45:41 +0530 |
---|---|---|
committer | rootavish <[email protected]> | 2014-08-11 06:45:41 +0530 |
commit | 020b11e5f204453614c7c45287d9b39c376d1e4a (patch) | |
tree | 0a44a205457fd0ca509a285344726b2e2378aed4 /backend/ps/ev-spectre.c | |
parent | 1548bcb4629a6a41641a0188003215b3098aa5fc (diff) | |
parent | 1bdae54253b68f2042f1d7f43ac0f36654c9b432 (diff) | |
download | atril-020b11e5f204453614c7c45287d9b39c376d1e4a.tar.bz2 atril-020b11e5f204453614c7c45287d9b39c376d1e4a.tar.xz |
Merge remote-tracking branch 'upstream/master' into epub
Diffstat (limited to 'backend/ps/ev-spectre.c')
-rw-r--r-- | backend/ps/ev-spectre.c | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/backend/ps/ev-spectre.c b/backend/ps/ev-spectre.c index d28325ba..b0489b78 100644 --- a/backend/ps/ev-spectre.c +++ b/backend/ps/ev-spectre.c @@ -224,7 +224,21 @@ static char * ps_document_get_page_label (EvDocument *document, EvPage *page) { - return g_strdup (spectre_page_get_label ((SpectrePage *)page->backend_page)); + const gchar *label = spectre_page_get_label ((SpectrePage *)page->backend_page); + gchar *utf8; + + if (!label) + return NULL; + + if (g_utf8_validate (label, -1, NULL)) + return g_strdup (label); + + /* Try with latin1 and ASCII encondings */ + utf8 = g_convert (label, -1, "utf-8", "latin1", NULL, NULL, NULL); + if (!utf8) + utf8 = g_convert (label, -1, "utf-8", "ASCII", NULL, NULL, NULL); + + return utf8; } static EvDocumentInfo * |