X-Git-Url: http://wagnertech.de/git?a=blobdiff_plain;f=SL%2FIconv.pm;h=aba271a0a226d7d03bc7f1cdda949bc9165a1769;hb=1268bf670c06f5a66ad78a75e41ad6c15061d9bc;hp=c2f2247eab9ed516ec1aac2ef70db3b02456cd22;hpb=cbd1249e5c245ee605c32c6cdbdc1e26f92643d0;p=kivitendo-erp.git diff --git a/SL/Iconv.pm b/SL/Iconv.pm index c2f2247ea..aba271a0a 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; @@ -33,11 +33,14 @@ sub convert { my ($from_charset, $to_charset, $text) = @_; - $from_charset ||= Common::DEFAULT_CHARSET; - $to_charset ||= Common::DEFAULT_CHARSET; + $from_charset ||= 'UTF-8'; + $to_charset ||= 'UTF-8'; - 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 {