Single byte to width byte
This post was last edited by Sevencolours24 on 2013-02-28 16:05:54
$msg = "China"
Now to send this MSG to another application to receive, how to convert MSG to UTF-16 encoded wide-byte, the application can be displayed correctly
I'm sending it right now, and I found a single byte.
------Solution--------------------
Look at the manual, with the return value of Iconv
$msg = Iconv (' usc-2 ', ' utf-16 ', $msg);
------Solution--------------------
wchar_t is the character data type of C/s + +, an extended character store, the wchar_t type is mainly used in the implementation of internationalized programs, but it is not equivalent to Unicode encoding. Unicode-encoded characters are typically stored in the wchar_t type. Char is a 8-bit character type, can contain up to 256 characters, many foreign language character sets contain more than 256 characters, and a char type cannot be represented.
The wchar_t data type is generally 16-bit or 32-bit, but different C or C + + libraries have different rules, such as the GNU libc wchar_t 32-bit [1], in short, wchar_t can represent more characters than the char type.
So it could just be
Iconv (' Utf-8 ', ' ucs-2 ', $msg)
Iconv (' Utf-8 ', ' ucs-4 ', $msg)
Iconv (' Utf-8 ', ' utf-16 ', $msg)
Iconv (' Utf-8 ', ' utf-32 ', $msg)
One
------Solution--------------------
Header ("Content-type:text/html;charset=utf-8")
This is just the server's response header.
Your file encoding is also utf-8, if not uniform, garbled is normal