The SQLite library contains a command line named Sqlite3, which allows the user to manually enter and execute SQL commands for the SQLite database. The database we create through the program is typically located in the package/databases of the content class where the/data/data/program DB is set, and the Sqlite3 database name can be entered into the SQL command line mode for database operation under this path.
If not set, the Command Line window to query the time, the Chinese display as garbled. This is because the default character set for CMD is GBK, and the default encoding used by Sqllite is Utf-8
If we solve this problem, we have the following two ways
"1" Command Setup method:
(1) Exit DOS or re-open the cmd window and enter:
[HTML]View Plaincopy
- Chcp 65001
And then enter OK
Note 65001 is the encoding setting for Unicode (UTF-8) 65001, Chinese Simplified (GB2312) is set to 936
(2) Right-click on the command line title bar and select "Properties"-"font" to change the font to "Lucida Console". Select the current window is valid or apply to all windows
"2" registry setting method:
(1) Open Registry Editor (regedit), expand to the following location
Hkey_current_user\console\%systemroot%_system32_cmd.exe
To modify a codepage entry to a decimal value
437 (English),
65001 (Utf-8),
936 (GBK).
This will allow you to open cmd after the character set will be modified. The character set, which is changed with the CHCP command, becomes the default value after the new CMD window is opened.
(2) Right-click on the command line title bar and select "Properties"-"font" to change the font to "Lucida Console". Select the current window is valid or apply to all windows
To supplement the use of the CHCP command:
[Plain]View Plaincopy
- chcp function: Toggle character format
- CHCP 65001 #换成utf-8 code page
- CHCP 936 #换成默认的gbk
- CHCP 437 #美国英语
- The general default is GBK,
Sqlite3 command line View Chinese garbled problem resolution