From 20ae81a602a2a1a72b2a6f3db58d496e59da4d13 Mon Sep 17 00:00:00 2001
From: Demian Katz <demian.katz@villanova.edu>
Date: Mon, 30 Jul 2018 16:49:07 -0400
Subject: [PATCH] UTF-8 normalization for cover generator.

---
 module/VuFind/src/VuFind/Cover/Layer/AbstractTextLayer.php | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/module/VuFind/src/VuFind/Cover/Layer/AbstractTextLayer.php b/module/VuFind/src/VuFind/Cover/Layer/AbstractTextLayer.php
index 1812adbbfd8..d914d593671 100644
--- a/module/VuFind/src/VuFind/Cover/Layer/AbstractTextLayer.php
+++ b/module/VuFind/src/VuFind/Cover/Layer/AbstractTextLayer.php
@@ -86,6 +86,10 @@ abstract class AbstractTextLayer extends AbstractLayer
     protected function drawText($im, $settings, $text, $y, $font, $fontSize, $mcolor,
         $scolor = false, $align = null
     ) {
+        // In case the text contains non-normalized UTF-8, fix that for proper
+        // display:
+        $text = \Normalizer::normalize($text);
+
         // If the wrap width is smaller than the image width, we want to account
         // for this when right or left aligning to maintain padding on the image.
         $wrapGap = ($settings->width - $settings->wrapWidth) / 2;
-- 
GitLab