How to solve the problem of Chinese display in php json format,
Returns a question about Chinese display of json data.
In the previous article, the returned Chinese Characters in json format are displayed as \ u5723 \ u8bde \ u8282 \ u5343 \ u4e07 \ u597d \ u793c \ u5927 \ u5949 \ u9001
Solution 1:Copy codeThe Code is as follows:Function Notice (){Include './include/conn. php'; // database link file$ SQL _notice = mysql_query ('select * FROM gg_notice where enable = "1" limit 0, 10 ');$ Notice =
This article mainly introduces how to solve the problem of Chinese character display in PHPJSON format. This article summarizes three methods to solve the problem of Chinese character display starting with u, for more information about how to display json data in Chinese, see
In the previous article, the returned Chinese characters in json format are displayed as \ u5723 \ u8bde \ u8282 \ u5343 \ u4e07 \ u597d \ u793c \ u5927 \ u5949 \ u9001
Solution 1:
The code is as follows:
Function Notice (
This article mainly introduces how to solve the problem of Chinese character display in PHPJSON format. This article summarizes three methods to solve the problem of Chinese character display starting with u, for more information about how to display json data in Chinese, see
In the previous article, the returned Chinese characters in json format are displayed as \ u5723 \ u8bde \ u8282 \ u5343 \ u4e07 \ u597d \ u793c \ u5927 \ u5949 \ u9001
Solution 1:
The code is as follows:
Function Notice
) = [-2,-1, 95, 32, 78, 9]byte[] BGBK = name.getbytes (GBK); Name conversion to GBK after byte stream = [-43,-59,-56,-3]byte[] Butf8 = name.getbytes (UTF8); The byte stream after name is converted to UTF8 = [-27,-68,-96,-28,-72,-119]From this we can see that after executing string name = "Zhang San", the string stored is already the system default character encoded UTF16 (Big-endian).Perhaps the attentive person will find out why the "Zhang San" byte Count is [-2,-1, 95, 32, 78, 9] with 6 bytes?
expressed using multiple bytes to express a symbol. For example, the common encoding method in Simplified Chinese is GB2312, which uses two bytes to represent a Chinese character, so it is theoretically possible to represent a maximum of 256x256=65536 symbols.The issue of Chinese coding needs to be discussed in this article, which is not covered by this note. It is only pointed out that although a symbol is represented in multiple bytes, the Chinese character coding of the GB class is irrelevan
equivalent to 20-bit encoding, the value between 0 and 0x10ffff, basically is the implementation of Unicode encoding. it is a variable length code, which is related to the CPU order, but because it saves the most space, it is often used as an external code for network transmission.
The UTF-16 is Unicode preferred encoding.
UTF-32, Uses only 32-bit encoding in the Unicode range (0 to 0x10ffff), equivalent to a subset of the UCS-4.
UTF and
' Compilation ', ' compilation ', why the byte array length obtained is not the sameHttp://www.cnblogs.com/yongdaimi/p/5899328.htmlUnicode official websitehttp://unicode.org/Utf-8 Kanji Comparison TableHttp://blog.chinaunix.net/uid-25544300-id-3281847.htmlReference to inner and outer codeshttps://www.zhihu.com/question/27562173Code unit and Code pointhttp://www.jianshu.com/p/a7db6ac53d57Coding problem, write very fine, but at present do not understandHttp://www.fmddlmyy.cn/text6.htmlUnicoce code
mapping table and GBXX series are completely different, compared to a "medium" word, which is two distinct bytes in BIG5 and GB2312. There will be garbled, such as ("Tao Zhe" and "Taujigi"), a variety of Simplified Chinese and traditional transcoding tools appear.
What do you mean, BIG5?
Five Chinese packaged software: Clerical processing, database, trial table, communication, drawing. Basically, this set of codes is mainly used in these 5 areas.
Is it cumbersome for countries to use each coun
. Therefore, the English character is represented in 1 bytes, and the Chinese character is identified by two bytes.
Unicode for how to handle Chinese own text we can set up a set of coding specifications according to our own needs, but computers are not only used by Americans and Chinese, but also in Europe and other Asian countries such as Japanese, Korean all over the world to add up to an estimated hundreds of thousands of of the text, which has greatly exceeded the ASCII and even GBK can
platforms. When Unicode begins to develop, the memory capacity of the computer is greatly developed and space is no longer a problem. So ISO is directly required to use two bytes, that is, 16-bit to unify all the characters, for those "half-width" characters in ASCII, Unicode keeps its original encoding unchanged, only extending its length from 8 bits to 16 bits, while other cultures and language characters are all reunified. Because the "half angle" English symbol only needs to use the low 8 d
What is UTF8UTF8 is not a computer code, but a form of storage and transmission, as described above, each unicode/ucs character is stored in 2 or 4 bytes to see the following comparisons:Take "I am Chinese" as an exampleStore with ANSI: BytesStorage with UNICODE/UCS2: Bytes + 2 Bytes (header)Storage with UCS4: Bytes + 4 Bytes (header)Take the example of "I am Chinese"Store with ANSI: Ten BytesStorage with UNICODE/UCS2: Bytes + 2 Bytes (header)Storage
Brief introduction
Today's applications are often designed for international use. These applications may need to handle strings in different languages. Unicode is a language-independent character representation standard.
Because the Java programming language already uses Unicode internally to represent characters, the development of internationalized applications is much easier. However, you cannot consider only the application side. The back-end database must also be able to handle Unicode ch
This article mainly introduces how to solve the problem of Chinese Character Display in PHPJSON format. This article summarizes three methods to solve the problem of Chinese character display starting with u. For more information, see
This article mainly introduces how to solve the problem of Chinese display in php json format. This article summarizes three methods to solve the problem of Chinese display starting with \ u. For more information, see
Returns a question about Chinese display
$str = preg_replace_callback( "#\\\u([0-9a-f]{4})#i", function($matchs) { return iconv('UCS-2BE', 'UTF-8', pack('H4', $matchs[1])); },
I searched the relevant information, understand a probable, but the essence of the part still do not understand.1) The first parameter of the Preg_replace_callback () function should be a regular expression that matches the relevant charact
Solution to the problem of Chinese display in PHPJSON format ,. Solution to the problem of Chinese display in PHPJSON format: return the question of Chinese display in json data in the previous article, return the Chinese display in json format to u5723u8bdeu8282u5343u4e07u597d Chinese display in php json format. solution,
Returns a question about Chinese display of json data.
In the previous article, the returned Chinese characters in json format are displayed as \ u5723 \ u8bde \ u8282 \ u534
in ASCII. So Americans are not aware of any mistakes. Only other countries in the world need high bytes. Specifically, the Unicode code point of the "hello" string is u + 0048 U + 0065 U + 006c U + 006c U + 006f, which is stored as 48 65 6C 6C 6f. It has the same meaning as ASCII, ANSI, and any OEM character set on this planet.
Now, if you want to represent the accent character or Greek, you need to use multiple bytes to represent a Code Point. But Americans don't mind this (the benefit of UTF
Character Set is generated. It uses 16 bits (two bytes) to represent a character, which can represent 65536 characters in total.The n standard Unicode is known as the UTF-16 (UTF: UCS Transformation Format ). Later, in order to enable the dual-byte Unicode to be correctly transmitted in the existing single-byte processing system, a UTF-8 emerged and Unicode was encoded in a way similar to MBCS. (UNICODE character sets have multiple encoding formats)F
PHP JSON format for Chinese display problem solving method,
Returns the problem of displaying JSON data in Chinese
In the previous article, the returned JSON format in Chinese is displayed as \u5723\u8bde\u8282\u5343\u4e07\u597d\u793c\u5927\u5949\u9001
Workaround One:Copy the Code code as follows:function Notice () {Include './include/conn.php '; Database link File$sql _notice = mysql_query (' SELECT * from gg_notice where enable = "1" limit 0,10 ');$notice = mysql_fetch_array ($sql _notice, MY
UTF byte order and BOM
The byte order of the UTF-8UTF and BOM are encoded in bytes, there is no problem of the byte order. The UTF-16 uses two bytes as the encoding unit. before interpreting a UTF-16 text, you must first understand the byte order of each encoding unit. For example, if the Unicode encoding of "queue" is 594e and that of "B" is 4e59. If we receive the UTF-16 byte stream "594e", is this "Kui" or "B "?
The recommended method for marking byte order in Unicode specifications is Bom. B
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.