Home php教程 php手册 找了一个中文转化UNICODE底的函数

找了一个中文转化UNICODE底的函数

Jun 21, 2016 am 09:12 AM
gb quot substr

函数|中文

// GB2312 转换为 unicode 的函数  
// Program by sadly (www.phpx.com)

function gb2unicode($gb)
{
  if(!trim($gb))
   return $gb;
  $filename="gb2312.txt";
  $tmp=file($filename);
  $codetable=array();
  while(list($key,$value)=each($tmp))
   $codetable[hexdec(substr($value,0,6))]=substr($value,9,4);
  $utf="";
  while($gb)
  {
   if (ord(substr($gb,0,1))>127)
    {
    $this=substr($gb,0,2);
    $gb=substr($gb,2,strlen($gb));
    $utf.="".$codetable[hexdec(bin2hex($this))-0x8080].";";
    }
   else
    {
    $gb=substr($gb,1,strlen($gb));
    $utf.=substr($gb,0,1);
    }
   }
  return $utf;
}
?>

但是我没有gb2312码表,哪位能提供一份啊?



Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

AI Hentai Generator

AI Hentai Generator

Generate AI Hentai for free.

Hot Article

R.E.P.O. Energy Crystals Explained and What They Do (Yellow Crystal)
2 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
Repo: How To Revive Teammates
4 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
Hello Kitty Island Adventure: How To Get Giant Seeds
4 weeks ago By 尊渡假赌尊渡假赌尊渡假赌

Hot Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

How many GB is 1t of memory equal to? How many GB is 1t of memory equal to? Feb 22, 2023 pm 04:55 PM

1t memory is equal to 1024GB. 1t memory refers to the memory storage capacity of "1TB", and 1TB is equal to 1024GB. But this is only a theoretical value based on computer principles. Generally, the available storage space displayed by the system will be less; because the hard drive manufacturer's definition of the hard drive is different from the computer's algorithm for the hard drive capacity, resulting in the hard drive identification capacity and the operating system display. Actual capacity may vary.

How many MB is 1g of memory? How many MB is 1g of memory? Mar 16, 2023 pm 04:19 PM

1g memory is 1024MB. g stands for "GB", which means "gigabyte" in Chinese, and MB refers to "megabyte"; GB and MB are both commonly used to indicate the storage capacity of computer hard drives, memories and other storage media with larger capacities. The conversion rate between GB and MB is approximately equal to 1000 (1024), that is, "1GB=1024MB".

1g equals how many MB of memory capacity 1g equals how many MB of memory capacity Feb 03, 2023 pm 03:55 PM

1g is equal to 1024MB memory capacity. The full name of g is "GB", which means "gigabyte" in Chinese. It is a decimal unit of information measurement and is often used to indicate the storage capacity of computer hard drives, memories and other large-capacity storage media. The conversion rate between GB and MB is approximately equal to 1000 (1024), that is, "1GB = 1024MB".

Is 1 megabit 1G? Is 1 megabit 1G? Feb 27, 2023 pm 03:43 PM

1 trillion is not 1G. 1 megabyte is 1MB, and 1G is equal to 1024MB. The full name of MB is "MByte", which refers to the number of bytes. It is a storage unit in computers and is pronounced as "mega"; while GB is a decimal unit of information measurement, 1GB=1024MB, 1GB=1048576KB, 1GB=1073741824B.

What is the storage capacity of a 10GB hard drive? What is the storage capacity of a 10GB hard drive? Mar 08, 2023 am 10:35 AM

A 10GB hard drive represents a storage capacity of "10 billion bytes." Byte is a unit of measurement used by computer information technology to measure storage capacity, usually abbreviated as "B"; gb, also called gigabyte, is a decimal unit of information measurement. Hard drive manufacturers usually calculate in decimal places: 1KB=1000B, 1MB=1000KB, 1GB=1000MB; therefore, if you convert "1GB=1000MB=1000*1000KB=1000*1000*1000B", it is 10 billion bytes.

php提交表单通过后,弹出的对话框怎样在当前页弹出,该如何解决 php提交表单通过后,弹出的对话框怎样在当前页弹出,该如何解决 Jun 13, 2016 am 10:23 AM

php提交表单通过后,弹出的对话框怎样在当前页弹出php提交表单通过后,弹出的对话框怎样在当前页弹出而不是在空白页弹出?想实现这样的效果:而不是空白页弹出:------解决方案--------------------如果你的验证用PHP在后端,那么就用Ajax;仅供参考:HTML code

PHP returns the ASCII value of the first character of the string PHP returns the ASCII value of the first character of the string Mar 21, 2024 am 11:01 AM

This article will explain in detail the ASCII value of the first character of the string returned by PHP. The editor thinks it is very practical, so I share it with you as a reference. I hope you can gain something after reading this article. PHP returns the ASCII value of the first character of a string Introduction In PHP, getting the ASCII value of the first character of a string is a common operation that involves basic knowledge of string processing and character encoding. ASCII values ​​are used to represent the numeric value of characters in computer systems and are critical for character comparison, data transmission and storage. The process of getting the ASCII value of the first character of a string involves the following steps: Get String: Determine the string for which you want to get the ASCII value. It can be a variable or a string constant

PHP returns the string from the start position to the end position of a string in another string PHP returns the string from the start position to the end position of a string in another string Mar 21, 2024 am 10:31 AM

This article will explain in detail how PHP returns the string from the start position to the end position of a string in another string. The editor thinks it is quite practical, so I share it with you as a reference. I hope you will finish reading this article. You can gain something from this article. Use the substr() function in PHP to extract substrings from a string. The substr() function can extract characters within a specified range from a string. The syntax is as follows: substr(string,start,length) where: string: the original string from which the substring is to be extracted. start: The index of the starting position of the substring (starting from 0). length (optional): The length of the substring. If not specified, then

See all articles