note 90550 modified in function.utf8-encode by danbrown

From: Date: Mon, 27 Apr 2009 21:48:53 +0000
Subject: note 90550 modified in function.utf8-encode by danbrown
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-153866@lists.php.net to get a copy of this message
you can convert any encode to utf and save it to mysql from this function : <?php function convert_charset($item) { if ($unserialize = unserialize($item)) { foreach ($unserialize as $key => $value) { $unserialize[$key] = @iconv('windows-1256', 'UTF-8', $value); } $serialize = serialize($unserialize); return $serialize; } else { return @iconv('windows-1256', 'UTF-8', $item); } } ?> --was-- you can convert any encode to utf and save it to mysql from this function : [PHP] function convert_charset($item) { if ($unserialize = unserialize($item)) { foreach ($unserialize as $key => $value) { $unserialize[$key] = @iconv('windows-1256', 'UTF-8', $value); } $serialize = serialize($unserialize); return $serialize; } else { return @iconv('windows-1256', 'UTF-8', $item); } } [/PHP] http://php.net/manual/en/function.utf8-encode.php

« previous php.notes (#153866) next »