Advertisement
Draven

convertEncode method

Aug 30th, 2012
75
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.51 KB | None | 0 0
  1.     /**
  2.      * convertEncode
  3.      *
  4.      * Converts encoding to UTF-8
  5.      *
  6.      * @param   $string
  7.      * @param   $encoding
  8.      * @access  private
  9.      */
  10.     private function convertEncode($string, $encoding)
  11.     {
  12.         # What type of encoding?
  13.         switch($encoding)
  14.         {
  15.             case "iso-8859-1":
  16.                 $string = utf8_encode($string);
  17.                 break;
  18.             case "us-ascii":
  19.                 $string = iconv($encoding, 'UTF-8', $string);
  20.                 break;
  21.             case "windows-1252":
  22.                 $string = iconv($encoding, 'UTF-8', $string);
  23.                 break;
  24.         }
  25.  
  26.         return $string;
  27.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement