[freeside-commits] branch FREESIDE_3_BRANCH updated. 07e67fc794333105b8832ff4f9aa70d407c6b8f3

Mitch Jackson mitch at freeside.biz
Sat Sep 29 15:50:40 PDT 2018


The branch, FREESIDE_3_BRANCH has been updated
       via  07e67fc794333105b8832ff4f9aa70d407c6b8f3 (commit)
       via  a5e01af2ff2d6b291a98a28ceeda0ca0089945ea (commit)
      from  088d455c563ca3b75be357727622d968e49b3ed1 (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 07e67fc794333105b8832ff4f9aa70d407c6b8f3
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 5048e4407..89957cb47 100644
--- a/FS/FS/Record.pm
+++ b/FS/FS/Record.pm
@@ -3434,7 +3434,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);
   }

commit a5e01af2ff2d6b291a98a28ceeda0ca0089945ea
Author: Mitch Jackson <mitch at freeside.biz>
Date:   Tue May 22 23:44:21 2018 -0500

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

diff --git a/FS/FS/Template_Mixin.pm b/FS/FS/Template_Mixin.pm
index f197d005a..d3994e57f 100644
--- a/FS/FS/Template_Mixin.pm
+++ b/FS/FS/Template_Mixin.pm
@@ -2251,8 +2251,7 @@ sub generate_email {
       warn "$me generating plain text invoice"
         if $DEBUG;
 
-      # 'print_text' argument is no longer used
-      @text = map Encode::encode_utf8($_), $self->print_text(\%args);
+      @text = $self->print_text(\%args);
 
     } else {
 
@@ -2268,7 +2267,11 @@ sub generate_email {
     'Encoding'    => 'quoted-printable',
     'Charset'     => 'UTF-8',
     #'Encoding'    => '7bit',
-    'Data'        => \@text,
+    'Data'        => [
+      map
+        { Encode::encode('UTF-8', $_, Encode::FB_WARN | Encode::LEAVE_SRC ) }
+        @text
+    ],
     'Disposition' => 'inline',
   );
 
@@ -2347,7 +2350,11 @@ sub generate_email {
                          '    </title>',
                          '  </head>',
                          '  <body bgcolor="#e8e8e8">',
-                         Encode::encode_utf8($html),
+                         Encode::encode(
+                           'UTF-8',
+                           $html,
+                           Encode::FB_WARN | Encode::LEAVE_SRC
+                         ),
                          '  </body>',
                          '</html>',
                        ],

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

Summary of changes:
 FS/FS/Record.pm         | 14 +++++++++++++-
 FS/FS/Template_Mixin.pm | 15 +++++++++++----
 2 files changed, 24 insertions(+), 5 deletions(-)




More information about the freeside-commits mailing list