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 / UTF-8.inc < prev    next >
Encoding:
Text File  |  2003-06-29  |  1.3 KB  |  54 lines

  1. <?php
  2. /////////////////////////////
  3. //    UTF-8.inc
  4. //    (C)2001-2002 Ryo Chijiiwa <Ryo@IlohaMail.org>
  5. //        
  6. //        Description:
  7. //                Shell encoding library for the US-ASCII charset.
  8. //                Since no encoding conversion should be required, all functions
  9. //                simply return the given strings.
  10. //
  11. //    This file is part of IlohaMail. IlohaMail is free software released 
  12. //    under the GPL license.  See enclosed file COPYING for details, or 
  13. //    see http://www.fsf.org/copyleft/gpl.html
  14. ////////////////////////////
  15. //      Added by SnAKes (snx@ifrance.com)
  16. ////////////////////////////
  17.  
  18. function LangIs8Bit($string){
  19.     $len = strlen($string);
  20.     for ($i=0; $i < $len; $i++)
  21.         if (ord($string[$i])>=128) return true;
  22.     
  23.     return false;
  24. }
  25.  
  26. function LangConvert($string, $charset, $charset2){
  27.     if($charset!=$charset2) return utf8_encode($string);
  28.     else return $string;
  29. }
  30.  
  31. function LangEncodeSubject($input, $charset){
  32.     if (LangIS8Bit($input)){
  33.         return "=?UTF-8?B?".base64_encode($input)."?=";
  34.     }else{
  35.         return $input;
  36.     }
  37. }
  38.  
  39. function LangEncodeMessage($input, $charset){
  40.     $message=$input;
  41.     $result["type"]="Content-Type: text/plain; charset=\"UTF-8\"\r\n";
  42.     $result["encoding"]="";
  43.     $result["data"] = $message;
  44.         
  45.     return $result;
  46. }
  47.  
  48. include_once("../lang/common.inc");
  49.  
  50. function LangWrap($str){
  51.     return wordwrap($str);
  52. }
  53. ?>
  54.