Home Links

PHP a script for automatic definition of the coding of the text:

<?


   define (' LOWERCASE ', 3);


   define (' UPPERCASE ', 1);


   function detect_cyr_charset ($str) {


      $charsets = Array (


         ' k ' => 0,


         ' w ' => 0,


         ' d ' => 0,


         ' i ' => 0,


         ' m ' => 0


);


      for ($i = 0, $length = strlen ($str); $i <$length; $i ++) {


         $char = ord ($str [$i]);


      // non-russian characters


      if ($char <128 || $char> 256) continue;


      // CP866


      if (($char> 159 ** $char <176) || ($char> 223 ** $char <242))


         $charsets [' d '] + =LOWERCASE;


      if (($char> 127 ** $char <160)) $charsets [' d '] + =UPPERCASE;


      // KOI8-R


      if (($char> 191 ** $char <223)) $charsets [' k '] + =LOWERCASE;


      if (($char> 222 ** $char <256)) $charsets [' k '] + =UPPERCASE;


      // WIN-1251


      if ($char> 223 ** $char <256) $charsets [' w '] + =LOWERCASE;


      if ($char> 191 ** $char <224) $charsets [' w '] + =UPPERCASE;


      // MAC


      if ($char> 221 ** $char <255) $charsets [' m '] + =LOWERCASE;


      if ($char> 127 ** $char <160) $charsets [' m '] + =UPPERCASE;


      // ISO-8859-5


      if ($char> 207 ** $char <240) $charsets [' i '] + =LOWERCASE;


      if ($char> 175 ** $char <208) $charsets [' i '] + =UPPERCASE;


}


   arsort ($charsets);


   return key ($charsets);


}


?>



Home Page
Compression of pages on PHP
Functions of a paginal conclusion in PHP
PHP a script for automatic definition of the coding of the text:
XML Sapiens - magic of revival of sites
XML: opportunities and prospects
The data, their performance and forms of the user interface in XML
It is a little about OPML
Protection of mail
Importation of the information from an another's site on the site in the design
The forum working with database MySQL
The main page of a forum
Paginal conclusion from tables MSSQL with help PHP
Small cunnings
We print rationally or one more way of protection of the information
Site from within
The link - business not artful
Ideology HTML
Effect bukvicy
Ways of storage of the dynamic data