projects
/
kivitendo-erp.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
424c012
)
Text bei Iconv-Konvertierung nach UTF-8 in Perls internes Encoding umwandeln
author
Moritz Bunkus
<moritz@bunkus.org>
Wed, 27 Apr 2011 07:48:11 +0000
(09:48 +0200)
committer
Moritz Bunkus
<moritz@bunkus.org>
Wed, 27 Apr 2011 07:48:11 +0000
(09:48 +0200)
Und das auch bei Objekt-Aufrufsyntax:
$text = SL::Iconv::convert('ISO-8859-15', 'UTF-8', $some_other_text);
SL/Iconv.pm
patch
|
blob
|
history
diff --git
a/SL/Iconv.pm
b/SL/Iconv.pm
index
d6ea0cb
..
19b8ca1
100644
(file)
--- a/
SL/Iconv.pm
+++ b/
SL/Iconv.pm
@@
-37,7
+37,10
@@
sub convert {
$to_charset ||= Common::DEFAULT_CHARSET;
my $converter = _get_converter($from_charset, $to_charset);
- return $converter->convert($text);
+ $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 {