projects
/
freeside.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
8fe6c83
)
RT# 79705 Correct UTF-8 output for generated E-Mail
author
Mitch Jackson
<mitch@freeside.biz>
Sat, 29 Sep 2018 22:48:39 +0000
(18:48 -0400)
committer
Mitch Jackson
<mitch@freeside.biz>
Sat, 29 Sep 2018 22:58:17 +0000
(18:58 -0400)
FS/FS/Record.pm
patch
|
blob
|
history
diff --git
a/FS/FS/Record.pm
b/FS/FS/Record.pm
index
e951178
..
9dd08cf
100644
(file)
--- a/
FS/FS/Record.pm
+++ b/
FS/FS/Record.pm
@@
-3641,7
+3641,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);
}