home *** CD-ROM | disk | FTP | other *** search
/ PC Professionell 2004 December / PCpro_2004_12.ISO / files / webserver / tsw / TSW_3.4.0.exe / Apache2 / admin / ISO-8859-1.inc < prev    next >
Encoding:
Text File  |  2003-06-29  |  1.3 KB  |  55 lines

  1. <?php
  2. /////////////////////////////
  3. //    ISO-8859-1.inc
  4. //    (C)2002 Ryo Chijiiwa <Ryo@IlohaMail.org>
  5. //        
  6. //        Description:
  7. //                Encoding library for the ISO-8859-1 charset.
  8. //
  9. //    This file is part of IlohaMail. IlohaMail is free software released 
  10. //    under the GPL license.  See enclosed file COPYING for details, or 
  11. //    see http://www.fsf.org/copyleft/gpl.html
  12. ////////////////////////////
  13.  
  14. include_once("../include/qp_enc.inc");
  15.  
  16. function LangIs8Bit($string){
  17.     $len = strlen($string);
  18.     for ($i=0; $i < $len; $i++)
  19.         if (ord($string[$i])>=128) return true;
  20.     
  21.     return false;
  22. }
  23.  
  24. function LangConvert($string, $charset){
  25.     return $string;
  26. }
  27.  
  28. function LangEncodeSubject($input, $charset){
  29.     $words = explode(" ", $input);
  30.     if ( count($words) > 0){
  31.         while ( list($k, $word) = each($words) ){
  32.             if (LangIs8Bit($word)) $words[$k] = "=?".$charset."?Q?".qp_enc($word, 76)."?=";
  33.         }
  34.         $input = implode(" ", $words);
  35.     }
  36.     return $input;
  37. }
  38.  
  39. function LangEncodeMessage($input, $charset){
  40.     $message=$input;
  41.     
  42.     $result["type"]="Content-Type: text/plain; charset=".$charset."\r\n";
  43.     $result["encoding"]="Content-Transfer-Encoding: quoted-printable\r\n";
  44.     $result["data"] = qp_enc($message, 78);
  45.         
  46.     return $result;
  47. }
  48.  
  49. include_once("../lang/common.inc");
  50.  
  51. function LangWrap($str){
  52.     return wordwrap($str);
  53. }
  54. ?>
  55.