PHP does not use iconv () function UTF8 to GB2312 string encoding.

time:10-07-16 forum:PHP tools and code
  Please download the gb2utf8 file first, when [url:3frdyb2d]http://www.11jn.com/gb2utf8.rar[/url:3frdyb2d]
[color=#FF0000] is downloaded, please unzip the gb2utf8.rar file to get the gb2utf8.txt file and put it in the same directory with your PHP program file. [/color]
[code]
.lt; php
function utf82gb ($utf8)
{
static $utf82gbcodetable;
/ / / / / / / > $codetablefile = file (.Quot; gb2utf8.txt.quot; 1);
$utf82gbcodetable=array ($utf82gbcodetable=array);
while (list ($key, $value)). T;.Quot;; $utf8! = '=';)
{
if (ord (substr ($utf8,0,1)).Gt; 224) {three bytes
$gb. = = > > 127) = > = > = = = > = > > =. $utf82gbcodetable.#91; substr ($utf8,0,2).#93;
$utf8=substr ($utf8,2);
} else {
$gb.=substr ($utf8,0,1);

/ / UTF8 to GB2312 string encoding END
.Gt; [/code]

prev:Conversion of GB2312 and Unicode code in... next:PHP does not use the iconv () function G...
post comment
Notice



approved   She was 10 years old as a babysitter...   Ji'nan "shit mountain" should be sho...   The first competition school in Chin...   These 9 kinds of scary symptoms foun...   A 9 year old student corrected the w...
rand   AJAX uses cookie to transmit values   The solution to the problem of chaot...   PHP AJAX implements no refresh page ...   A summary of the method of generatin...   PHP paging code, suitable for use in...
ads

other

Because all the contents of this site are reproduced from other media, the intention is to provide free services to the public, but it does not mean that this site agrees with its views, and can not be responsible for the authenticity of its verification, such as the copyright unit or individual of the manuscript does not want to publish on this site, please Contact me, I will immediately remove it, thank you. Contact: atseashawk@163.com