Sqlite saves the data in UTF8 format by default, and the existing program development tools are in the default GB2312 format, so the Chinese you write and write directly to the library without transcoding is definitely garbled with any database tool. But after reading out, it is still GB2312, so the display is normal. On the other hand, if you write Chinese with a database tool, the UTF8 format is stored by default, and it is garbled when read by a program. That is to say you cannot have both.
If you want to be able to program and read and write database tools normally, you must transcode. In other words, when saving, you need to convert GB2312 to UTF8, and when reading, you need to convert UTF8 to GB2312.
An online source program is available, a class called CCodingConv. You search for a source code and convert it before executing each SQL statement. Convert the entire SQL statement, the E text will remain unchanged, and the Chinese will be automatically converted into the appropriate encoding, and the implementation can achieve the requirements.
sqlite Chinese solution Chinese is stored according to UTF-8 encoding, when it is taken out, it will be converted to gb2312 and displayed.
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.