X-Git-Url: http://wagnertech.de/git?a=blobdiff_plain;f=SL%2FIconv.pm;h=19b8ca169839cb8eb90fd8b3f0c6974b61264f48;hb=beb61b2e270836ccd11e00ce68ff884cfb7a530d;hp=c2f2247eab9ed516ec1aac2ef70db3b02456cd22;hpb=cbd1249e5c245ee605c32c6cdbdc1e26f92643d0;p=kivitendo-erp.git diff --git a/SL/Iconv.pm b/SL/Iconv.pm index c2f2247ea..19b8ca169 100644 --- a/SL/Iconv.pm +++ b/SL/Iconv.pm @@ -19,7 +19,7 @@ sub new { return $self; } -sub get_converter { +sub _get_converter { my ($from_charset, $to_charset) = @_; my $index = join $SUBSCRIPT_SEPARATOR, $from_charset, $to_charset; @@ -36,8 +36,11 @@ sub convert { $from_charset ||= Common::DEFAULT_CHARSET; $to_charset ||= Common::DEFAULT_CHARSET; - my $converter = get_converter($from_charset, $to_charset); - return $converter->convert($text); + my $converter = _get_converter($from_charset, $to_charset); + $text = $converter->convert($text); + $text = decode("utf-8-strict", $text) if ($to_charset =~ m/^utf-?8$/i) && !Encode::is_utf8($text); + + return $text; } sub _convert {