sqlite3 - how to display chinese character properly in sqlite console? -


here sample csv file in utf-8 format can opened in win7's notepad , chinese character displayed ,please download .
http://pan.baidu.com/s/1sj0ia4h

open cmd ,and set chcp 650001.

c:\users\pengsir>sqlite3  e:\\test.db    sqlite version 3.8.4.3 2014-04-03 16:53:12   enter ".help" usage hints. sqlite> create table ipo(name text,method text); sqlite> .separator "," sqlite> .import  "e:\\tmp.csv"  ipo sqlite> select * ipo; 000001,公开招募 000002,申请表抽签é™é¢è®¤è´­ 000004,定å‘å‘è¡Œ 000005,银行储蓄存å•æ–¹å¼ 000006,申请表抽签é™é¢è®¤è´­ 000007,自办å‘è¡Œ 000008,自办å‘è¡Œ 000009,定å‘å‘è¡Œ 000010,定å‘å‘è¡Œ 000011,申请表抽签等é¢è®¤è´­ sqlite> 

why same sqlite command can proper display in sqlitemanager?
, how can set display chinese character in sqlite console?

enter image description here

in pysqlite3 , can right display in python console.

>>> import sqlite3   >>> con=sqlite3.connect("e:\\test.db")    >>> cur=con.cursor()    >>> cur.execute("select * ipo;")   <sqlite3.cursor object @ 0x01751720>   >>> print(cur.fetchall())    [('000001', '公开招募'), ('000002', '申请表抽签限额认购'), ('000004', '定向发行'    ), ('000005', '银行储蓄存单方式'), ('000006', '申请表抽签限额认购'), ('000007',    '自办发行'), ('000008', '自办发行'), ('000009', '定向发行'), ('000010', '定向发    行'), ('000011', '申请表抽签等额认购')]    >>>    

this issue concers how command prompt window shows characters, , not how sqlite3 prints output;

as simple demonstration here absolutely exclude sqlite3 , @ files type command:

let's see whats happen in other different o.s., example in osx: <img src="./osx-iso8859-1.png" /> iso-8859-1 correspond (windows latino 1), windows equivalent code page setting: chcp 819 <img src="./osx-utf-8.png" /> utf8 correspond unicode (utf-8), windows equivalent code page setting: chcp 65001

pretty same behavior happens in windows: use command chcp inspect and/or setting-up current code page

<img src="./win-xp.png" />

notice: screenshot of italian windows xp , can see there still no luck! :-( , in case cause consists in leak of available fonts configurable in command prompt properties in "windows xp" box:

i hope not case of "windows seven" box ( ..but if , please leave me comment more specific in part of answer ). ..when problem switches "fonts available" additional languages supports installed , still need forcing utf-8 chcp 65001:

<img src="./ok.png" />

how proper fonts

follows list of steps followed result on ita winxp sp2 shown in above screenshot:

step 1 install east asian language files on computer

lecture link: to install east asian language files on computer

in summary these 2 options have been both checked enter image description here , in "advanced tab" i've selected chinese: enter image description here

step 2 switch raster chinese font in terminal/"command windows"

enter image description here

extra step 3 (optional) check font in notepad

notepad can useful inspections on fonts, example open temp.csv , play fonts aware of: necessary criteria fonts available in command window

enter image description here


Comments

Popular posts from this blog

commonjs - How to write a typescript definition file for a node module that exports a function? -

openid - Okta: Failed to get authorization code through API call -

ios - Change Storyboard View using Seague -