|
|
|
|
Menu |
|
|
Home |
| |
|
Discussions |
| |
|
Tools |
| |
|
Affiliates |
| |
|
Content |
| |
|
Info |
| | |
|
|
|
|
|
User Info |
|
Membership:
Latest: MichaelSnaRe
New Today: 0
New Yesterday: 0
Overall: 9144
People Online:
Visitors: 76
Members: 0
Total: 76
|
|
|
|
|
|
Full disclosure |
|
|
|
|
|
|
IT Security and Insecurity Portal |
|
|
detect encoding of string and convert it to utf8? |
|
Posted: Sun Jul 03, 2011 3:04 am |
|
|
emrag |
Regular user |
|
|
Joined: Jun 03, 2004 |
Posts: 20 |
Location: TURKEY |
|
|
|
|
|
|
mb_detect_encoding doesn't work well. i found this useful code from php.net comments but it's still not reliable. any suggestion about to convert any encoding to ut8?
Code: | function fix_utf8($data)
{
$list = array('utf-8', 'iso-8859-9', 'iso-8859-1', 'windows-1251');
foreach($list as $item)
{
$sample = iconv($item, $item, $data);
if(md5($sample) == md5($data))
{
return iconv($item, 'utf-8', $sample);
}
unset($sample);
}
return null;
} |
|
|
|
|
|
www.waraxe.us Forum Index -> Php
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
All times are GMT
Page 1 of 1
|
|
|
Powered by phpBB © 2001-2008 phpBB Group
|
|
|
|
|
|
|