From f9e99e93c3b86afec0bba031b5a8d40c2ccee48b Mon Sep 17 00:00:00 2001
From: Laurent Destailleur <eldy@destailleur.fr>
Date: Mon, 27 Nov 2017 14:34:29 +0100
Subject: [PATCH] Fux utf8 trouble on direct printing message

---
 htdocs/core/actions_printing.inc.php              | 2 +-
 htdocs/core/modules/printing/printgcp.modules.php | 2 +-
 htdocs/langs/en_US/printing.lang                  | 1 +
 3 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/htdocs/core/actions_printing.inc.php b/htdocs/core/actions_printing.inc.php
index 4961c3e29f2..62b61e531bf 100644
--- a/htdocs/core/actions_printing.inc.php
+++ b/htdocs/core/actions_printing.inc.php
@@ -64,7 +64,7 @@ if ($action == 'print_file' and $user->rights->printing->read)
                     {
                         //print '<pre>'.print_r($printer->errors, true).'</pre>';
                         setEventMessages($printer->error, $printer->errors);
-                        setEventMessages($langs->trans("FileWasSentToPrinter", basename(GETPOST('file'))).' '.$langs->transnoentitiesnoconv("ViaModule").' '.$printer->name, null);
+                        setEventMessages($langs->transnoentitiesnoconv("FileWasSentToPrinter", basename(GETPOST('file', 'alpha'))).' '.$langs->transnoentitiesnoconv("ViaModule").' '.$printer->name, null);
                     }
                 }
                 catch(Exception $e)
diff --git a/htdocs/core/modules/printing/printgcp.modules.php b/htdocs/core/modules/printing/printgcp.modules.php
index 539db0ddee5..9268b8f89f9 100644
--- a/htdocs/core/modules/printing/printgcp.modules.php
+++ b/htdocs/core/modules/printing/printgcp.modules.php
@@ -318,7 +318,7 @@ class printing_printgcp extends PrintingDriver
         else dol_print_error($this->db);
 
         $ret = $this->sendPrintToPrinter($printer_id, $file, $fileprint, $mimetype);
-        $this->errors = 'PRINTGCP: '.mb_convert_encoding($ret['errormessage'], "UTF-8");
+        $this->errors = 'PRINTGCP: '.$ret['errormessage'];
         if ($ret['status']!=1) $error++;
         return $error;
     }
diff --git a/htdocs/langs/en_US/printing.lang b/htdocs/langs/en_US/printing.lang
index 36f4e75f23a..cc26879e4f1 100644
--- a/htdocs/langs/en_US/printing.lang
+++ b/htdocs/langs/en_US/printing.lang
@@ -9,6 +9,7 @@ PrintingDriverDesc=Configuration variables for printing driver.
 ListDrivers=List of drivers
 PrintTestDesc=List of Printers.
 FileWasSentToPrinter=File %s was sent to printer
+ViaModule=via the module
 NoActivePrintingModuleFound=No active driver to print document. Check setup of module %s.
 PleaseSelectaDriverfromList=Please select a driver from list.
 PleaseConfigureDriverfromList=Please configure the selected driver from list.
-- 
GitLab