note 91833 modified in book.mssql by danbrown
| From: | danbrown@php.net | Date: | Sat, 27 Jun 2009 14:34:48 +0000 |
| Subject: | note 91833 modified in book.mssql by danbrown | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-157629@lists.php.net to get a copy of this message | ||
if your sql server use ANSI encoding and your page use UTF-8, this is method to convert to UTF-8
<?php
function convertAnsi2UTF8($array){
foreach ($array as $key=>$item) {
if(is_array($item)) $array[$key]=convertAnti2UTF8($item);
else $array[$key]=iconv("TIS-620","UTF-8",$item);
}
return $array;
}
?>
--was--
if your sql server use ANSI encoding and your page use UTF-8, this is method to convert to UTF-8
function convertAnsi2UTF8($array){
foreach ($array as $key=>$item) {
if(is_array($item)) $array[$key]=convertAnti2UTF8($item);
else $array[$key]=iconv("TIS-620","UTF-8",$item);
}
return $array;
}
http://php.net/manual/en/book.mssql.php