[freeside-commits] branch FREESIDE_4_BRANCH updated. 8971fb03cc8bf443294331dedc262d68f4d0f60e

Mitch Jackson mitch at freeside.biz
Sat Sep 29 16:23:32 PDT 2018


The branch, FREESIDE_4_BRANCH has been updated
       via  8971fb03cc8bf443294331dedc262d68f4d0f60e (commit)
      from  f222a656ebe712021d004000ac83df6e69dd3677 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit 8971fb03cc8bf443294331dedc262d68f4d0f60e
Author: Mitch Jackson <mitch at freeside.biz>
Date:   Sat Sep 29 18:48:39 2018 -0400

    RT# 79705 Correct UTF-8 output for generated E-Mail

diff --git a/FS/FS/Record.pm b/FS/FS/Record.pm
index 08d681e47..ce12a1609 100644
--- a/FS/FS/Record.pm
+++ b/FS/FS/Record.pm
@@ -3629,7 +3629,19 @@ sub _quote {
            && driver_name eq 'Pg'
           )
   {
-    dbh->quote($value, { pg_type => PG_BYTEA() });
+    local $@;
+
+    eval { $value = dbh->quote($value, { pg_type => PG_BYTEA() }); };
+
+    if ( $@ && $@ =~ /Wide character/i ) {
+      warn 'Correcting malformed UTF-8 string for binary quote()'
+        if $DEBUG;
+      utf8::decode($value);
+      utf8::encode($value);
+      $value = dbh->quote($value, { pg_type => PG_BYTEA() });
+    }
+
+    $value;
   } else {
     dbh->quote($value);
   }

-----------------------------------------------------------------------

Summary of changes:
 FS/FS/Record.pm | 14 +++++++++++++-
 1 file changed, 13 insertions(+), 1 deletion(-)




More information about the freeside-commits mailing list