Table of Contents
回复讨论(解决方案)
Home Backend Development PHP Tutorial 关于UTF-8 和 GB2312问题(请各位大哥解答下小弟)

关于UTF-8 和 GB2312问题(请各位大哥解答下小弟)

Jun 23, 2016 pm 01:56 PM
utf-8 Big brother answer


你们平时做站用都是 UTF-8 还是 GB2312 ?

如果一个网站    用JQUERY 和 AJAX   是用  UTF-8还是 GB2312好些 ?

因为我在做一些简单项目的时候  GB2312 遇到 AJAX 会乱码 

我看国内站绝大多数用的都是 GB2312





回复讨论(解决方案)

果断UTF-8! 
数据库里存utf8_general_ci字符集

最起码保证前后台一致吧;
我一直用的utf8,好像没多大区别,我只知道utf8占3个字节,GBK占2个字节。一直用的utf8妥妥的!

1、国人当然应首选国家标准
2、与 utf-8 中文对等的是 gbk(不是gb2312)
3、存储一个 utf-8 中文字符需要 3 个字节,存储一个 gbk 中文字符只需要 2 个字节
      我想国人还没有富裕到比洋人还要奢侈的地步
4、无论你是用 utf-8 还是 gbk,方块字也只有懂得人才能认识
     虽然中文也是联合国的工作语言,但毕竟老外能看懂的并不多
5、AJAX 默认以 utf-8 编码发送,接收时根据收到的语言声明能识别任何字符集
6、浏览器会将接收到的任何字符集统一转换成 unicode 字符集
综上所述,我倾向于使用 gbk 编码(事实上我也是这么做的)


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
3 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)

Five common Go language interview questions and answers Five common Go language interview questions and answers Jun 01, 2023 pm 08:10 PM

As a programming language that has become very popular in recent years, Go language has become a hot spot for interviews in many companies and enterprises. For beginners of the Go language, how to answer relevant questions during the interview process is a question worth exploring. Here are five common Go language interview questions and answers for beginners’ reference. Please introduce how the garbage collection mechanism of Go language works? The garbage collection mechanism of the Go language is based on the mark-sweep algorithm and the three-color marking algorithm. When the memory space in the Go program is not enough, the Go garbage collector

Why is there a big brother guarding the anchor in the Douyin app? The reason why the anchor is guarded in the live broadcast room Why is there a big brother guarding the anchor in the Douyin app? The reason why the anchor is guarded in the live broadcast room Mar 12, 2024 pm 01:20 PM

Why is there a big brother guarding the anchor in the Douyin app? I believe that many friends will call out Big Brother to protect their live broadcast room when watching PK on Douyin app. So what kind of character is Big Brother? Why does he protect the live broadcast room inside for no reason? Let us take a look at these questions together. The results of the investigation by the editor of this site's software park hope to satisfy every curious user. Reasons for protecting the anchors in the live broadcast room of Yin app: 1. If you are bored and have money, watching live broadcasts is a way to kill time. If the content is exciting, paying to watch is also an acceptable option. 2. Like Only true love is possible to do such a thing. 3. Attracted by the anchor’s talent

CentOS File System FAQ CentOS File System FAQ Feb 23, 2024 pm 12:45 PM

CentOS file system FAQ The file system is a crucial component in using the CentOS operating system. It is responsible for storing, organizing and managing files and directories, and plays a vital role in the stable operation of the system and data security. However, inevitably, you will encounter some common problems when using file systems. This article will answer common questions about the CentOS file system, hoping to help readers better understand and deal with these problems. Question 1: How to check the usage of file system

ThinkPHP6 FAQ ThinkPHP6 FAQ Jun 20, 2023 am 09:14 AM

With the development of the Internet era, web development frameworks are developing rapidly. ThinkPHP is an efficient web development framework based on the PHP language. It has excellent scalability and efficiency. It is one of the most widely used PHP development frameworks in China. The current version is ThinkPHP6, which is the latest version of ThinkPHP. It comes with many features such as routing, automatic loading, multiple applications, controller middleware, event mechanism, etc., and has a large number of users and contributors. This article will focus on the common problems of ThinkPHP6

Binary tree algorithm in PHP and FAQs Binary tree algorithm in PHP and FAQs Jun 09, 2023 am 09:33 AM

With the continuous development of web development, PHP, as a widely used server scripting language, its algorithms and data structures are becoming more and more important. Among these algorithms and data structures, the binary tree algorithm is a very important concept. This article will introduce the binary tree algorithm and its applications in PHP, as well as answers to common questions. What is a binary tree? A binary tree is a tree structure in which each node has at most two child nodes, a left child node and a right child node. If a node has no child nodes, it is called a leaf node. Binary trees are often used for searching

PHP change character encoding vector in font PHP change character encoding vector in font Mar 21, 2024 pm 03:11 PM

This article will explain in detail about changing the character encoding vector in fonts in 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. Changing the character encoding in a string in PHP In PHP, the character encoding of a string determines how the characters are represented. To change the character encoding of a string, you can use the following steps: 1. Determine the current character encoding $encoding=mb_detect_encoding($string); This will return a string representing the current character encoding of the string, such as "UTF-8" or "ISO-8859-1". 2. Use mb_convert_encoding

Must-read before exam: Go language exam FAQs Must-read before exam: Go language exam FAQs Mar 22, 2024 pm 04:48 PM

Must-read before exam: Go language exam FAQ As a rapidly developing programming language, Go language has gradually been widely used in enterprise-level application development. For students who want to improve their skills or take relevant exams, it is very important to be proficient in the Go language. When preparing for the exam, understanding some common questions and their answers, and mastering the corresponding code examples will help improve exam efficiency and pass the exam. This article will answer common questions in the Go language exam and provide specific code examples.

PHP returns the name of the character set PHP returns the name of the character set Mar 21, 2024 am 09:56 AM

This article will explain in detail the name of the character set 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. 1. Character set in PHP The character set in PHP is used to represent a collection of letters, numbers and symbols used in text data. It defines how byte sequences are mapped to character values. PHP supports multiple character sets, including: ASCII: American Standard Code for Information Interchange, containing 7-bit characters and used in text-based systems. UTF-8: Universal Character Set Transformation Format - 8-bit, a variable-length character set widely used in modern systems. UTF-16: Universal Character Set Transformation Format - 16 bits, a fixed-length character set used to represent large numbers of characters

See all articles