note 47499 added to function.iconv

From: Date: Thu, 18 Nov 2004 09:14:10 +0000
Subject: note 47499 added to function.iconv
Groups: php.notes 
Request: Send a blank email to php-notes+get-80690@lists.php.net to get a copy of this message
Here is an example how to convert windows-1251 (windows) or cp1251(Linux/Unix) encoded string to UTF-8 encoding. <?php function cp1251_utf8( $sInput ) { $sOutput = ""; for ( $i = 0; $i < strlen( $sInput ); $i++ ) { $iAscii = ord( $sInput[$i] ); if ( $iAscii >= 192 && $iAscii <= 255 ) $sOutput .= "&#".( 1040 + ( $iAscii - 192 ) ).";"; else if ( $iAscii == 168 ) $sOutput .= "&#".( 1025 ).";"; else if ( $iAscii == 184 ) $sOutput .= "&#".( 1105 ).";"; else $sOutput .= $sInput[$i]; } return $sOutput; } ?> ---- Manual Page -- http://www.php.net/manual/en/function.iconv.php Edit -- http://master.php.net/manage/user-notes.php?action=edit+47499 Delete -- http://master.php.net/manage/user-notes.php?action=delete+47499&report=yes Reason: bad code -- http://master.php.net/manage/user-notes.php?action=delete+47499&report=yes&reason=bad+code Reason: spam -- http://master.php.net/manage/user-notes.php?action=delete+47499&report=yes&reason=spam Reason: useless example -- http://master.php.net/manage/user-notes.php?action=delete+47499&report=yes&reason=useless+example Reason: contains commercial links -- http://master.php.net/manage/user-notes.php?action=delete+47499&report=yes&reason=contains+commercial+links Reason: useless note -- http://master.php.net/manage/user-notes.php?action=delete+47499&report=yes&reason=useless+note Reject -- http://master.php.net/manage/user-notes.php?action=reject+47499&report=yes Search -- http://master.php.net/manage/user-notes.php

« previous php.notes (#80690) next »