Commit bc8e5e94 authored by Alex Vandiver's avatar Alex Vandiver
Browse files

Comment the logic for database decode_utf8/is_utf8 checking

parent 89a85683
......@@ -656,12 +656,16 @@ sub __Value {
return undef if (!defined $value);
# Pg returns character columns as character strings; mysql and
# sqlite return them as bytes. While mysql can be made to return
# characters, using the mysql_enable_utf8 flag, the "Content" column
# is bytes on mysql and characters on Postgres, making true
# consistency impossible.
if ( $args{'decode_utf8'} ) {
if ( !utf8::is_utf8($value) ) {
if ( !utf8::is_utf8($value) ) { # mysql/sqlite
utf8::decode($value);
}
}
else {
} else {
if ( utf8::is_utf8($value) ) {
utf8::encode($value);
}
......
......@@ -745,6 +745,9 @@ sub MapSubValues {
my $dst = $item->{'values'}{ lc $to } = { };
while (my ($k, $v) = each %{ $map } ) {
$dst->{ $k } = delete $item->{'values'}{ lc $v->{'NAME'} };
# This mirrors the logic in RT::Record::__Value When that
# ceases tp use the UTF-8 flag as a character/byte
# distinction from the database, this can as well.
utf8::decode( $dst->{ $k } )
if defined $dst->{ $k }
and not utf8::is_utf8( $dst->{ $k } );
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment