/** * Converts an array containing ISO-8859-1 string to utf-8 * * @param array $obj */ public static function toISO_recursive(array &$obj) { foreach ($obj as $field => &$value) { if (is_string($value)) { $value = utf8_decode($value); } else { if (is_array($value)) { AppKitArrayUtil::toISO_recursive($value); } } } }
/** * @group AppKit */ public function testEncodingProcessor1() { $test = array('test1' => 'ÜÜöö%%123', 'test2' => array('ÖÖÖ', 'ÄÄÄ', 'ßßß')); $work = $test; AppKitArrayUtil::toISO_recursive($work); $this->assertNotEquals($test, $work); AppKitArrayUtil::toUTF8_recursive($work); $this->assertEquals($test, $work); }