From: Michael M Slusarz Date: Thu, 20 Jan 2011 20:23:54 +0000 (-0700) Subject: Bug #9528: Fix Windows-1258 conversion X-Git-Url: https://git.internetallee.de/?a=commitdiff_plain;h=311a4e0c459a459b49512631fd86a40f3a2468d5;p=horde.git Bug #9528: Fix Windows-1258 conversion Remove workaround for broken iconv() added here: http://git.horde.org/co.php/framework/Util/Attic/String.php?sa=1&rt=horde&r=1.19 There's no PHP bug referenced, and I can't find any. Adding this extra character breaks Windows-1258 conversion. If it was a bug in 2003, hopefully it has been fixed by now (all unit tests pass). --- diff --git a/framework/Util/lib/Horde/String.php b/framework/Util/lib/Horde/String.php index cfc90a9df..2bf823a58 100644 --- a/framework/Util/lib/Horde/String.php +++ b/framework/Util/lib/Horde/String.php @@ -144,16 +144,13 @@ class Horde_String /* Try iconv with transliteration. */ if (Horde_Util::extensionExists('iconv')) { - /* We need to tack an extra character temporarily because of a bug - * in iconv() if the last character is not a 7 bit ASCII - * character. */ unset($php_errormsg); ini_set('track_errors', 1); - $out = @iconv($from, $to . '//TRANSLIT', $input . 'x'); + $out = @iconv($from, $to . '//TRANSLIT', $input); $errmsg = isset($php_errormsg); ini_restore('track_errors'); if (!$errmsg) { - return self::substr($out, 0, -1, $to); + return $out; } } diff --git a/framework/Util/test/Horde/Util/StringTest.php b/framework/Util/test/Horde/Util/StringTest.php index 0c55d216c..06004926c 100644 --- a/framework/Util/test/Horde/Util/StringTest.php +++ b/framework/Util/test/Horde/Util/StringTest.php @@ -450,4 +450,13 @@ EOT $this->assertEquals('foo', Horde_String::common('foobar', 'fooxyx')); $this->assertEquals('foo', Horde_String::common('foo', 'foobar')); } + + public function testBug9528() + { + $this->assertEquals( + "", + Horde_String::convertCharset("", 'UTF-8', 'Windows-1258') + ); + } + }