Hello everyone, I found some strange behavior when using the Command Line Shell For SQLite.

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Hello everyone, I found some strange behavior when using the Command Line Shell For SQLite.

算 子
In column mode, each record is shown on a separate line with the data aligned in columns. For example:

sqlite> .mode column
sqlite> select * from tbl1;
one           two      
----------  ----------
hello         10        
goodbye   20        
sqlite>


But I found,only when columns text is ANSI,it can normal work.

sqlite> .mode column
sqlite> select * from 语言声明表;
语言指针        引用数量        语言名称        语言注释
----------  ----------  ----------  ----------
1           0           1           0
2           0           2           0

If the columns text is utf-8,it can't work.
What should I do for it?
_______________________________________________
sqlite-users mailing list
[hidden email]
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users
Reply | Threaded
Open this post in threaded view
|

Re: Hello everyone, I found some strange behavior when using the Command Line Shell For SQLite.

Kees Nuyt
On Thu, 3 Oct 2019 09:46:27 +0000, [hidden email] wrote:

> In column mode, each record is shown on a separate
> line with the data aligned in columns. For example:
> sqlite> .mode column
> sqlite> select * from tbl1;
> one           two      
> ----------  ----------
> hello         10        
> goodbye   20        
> sqlite>
>
> But I found,only when columns text is ANSI,it can normal work.
> sqlite> .mode column
> sqlite> select * from ?????;
> ????        ????        ????        ????
> ----------  ----------  ----------  ----------
> 1           0           1           0
> 2           0           2           0
>
> If the columns text is utf-8,it can't work.
> What should I do for it?


It works for me, using UTF-8 language settings for the terminal,
and a font that contains enough of UTF-8.

~ $ uname -a
Linux f7p3 4.19.66-v7+ #1253 SMP Thu Aug 15 11:49:46 BST 2019 armv7l GNU/Linux

~ $ set|grep -E '(LC_|LANG)'
LANG=en_US.utf-8
LC_ALL=
LC_COLLATE=en_US.utf-8
LC_CTYPE=en_US.utf-8
LC_MESSAGES=en_US.utf-8
LC_MONETARY=en_US.utf-8
LC_NUMERIC=en_US.utf-8
LC_TIME=en_US.utf-8

Column names used: e-acute and a-umlaut

~ $ sqlite3 test.db
SQLite version 3.30.0 2019-09-25 18:44:49
Enter ".help" for usage hints.
sqlite> CREATE TABLE x (é integer primary key,ä TEXT);
sqlite> INSERT INTO x VALUES (1,'téxt');
sqlite> . mode column
sqlite> . head on
sqlite> select * FROM x;
é           ä
----------  ----------
1           téxt
sqlite>.q

~ $ sqlite3 test.db \
".mode column" ".head on" ".width 1 4" "SELECT * FROM x" \
| hexdump -C

0000 c3 a9 20 20 c3 a4 20 20  20 0a 2d 20 20 2d 2d 2d |..  ..   .-  ---|
0010 2d 0a 31 20 20 74 c3 a9  78 74 0a                |-.1  t..xt.|
001b

--
Regards,
Kees Nuyt
_______________________________________________
sqlite-users mailing list
[hidden email]
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users
Reply | Threaded
Open this post in threaded view
|

Re: Hello everyone, I found some strange behavior when using the Command Line Shell For SQLite.

Richard Damon
In reply to this post by 算 子
On 10/3/19 5:46 AM, 算 子 wrote:

> In column mode, each record is shown on a separate line with the data aligned in columns. For example:
>
> sqlite> .mode column
> sqlite> select * from tbl1;
> one           two      
> ----------  ----------
> hello         10        
> goodbye   20        
> sqlite>
>
>
> But I found,only when columns text is ANSI,it can normal work.
>
> sqlite> .mode column
> sqlite> select * from 语言声明表;
> 语言指针        引用数量        语言名称        语言注释
> ----------  ----------  ----------  ----------
> 1           0           1           0
> 2           0           2           0
>
> If the columns text is utf-8,it can't work.
> What should I do for it?
> _______________________________________________
> sqlite-users mailing list
> [hidden email]
> http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users

My guess is that column mode doesn't understand all the strangeness that
comes with Unicode and fonts, and probably expects that each code point
is exactly the same width. I note that at least on my computer the CJK
characters are wider than the ASCII characters, and thus makes columns
not align.

--
Richard Damon

_______________________________________________
sqlite-users mailing list
[hidden email]
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users