/ View Ticket
Login
Ticket UUID: 6c266900a22574d4d6474503da5bfe849c8b244f
Title: shell: The column mode (and width option) does not manage correctly UTF-8
Status: Open Type: Feature_Request
Severity: Minor Priority: Immediate
Subsystem: Shell Resolution: Open
Last Modified: 2014-03-11 12:44:44
Version Found In: 3.7.13
User Comments:
nobody added on 2013-01-02 00:08:44: (text/x-fossil-wiki)
Hello,

Martin Godisch notes that sqlite3 CLI doesn't count multi-byte characters correctly. He uses an example with the <em>width</em> option to highlight the problem. However, I think this is the <em>column</em> mode that does not comply with UTF-8, rather than the <em>width</em> option.

This bug has been detected by Martin Godisch in version 3.5.9 packaged for Debian (see Debian Bug report: [http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=536662|#536662]) and I still found it in version 3.7.13 (packaged for Debian also). I use the sqlite3 3.7.13-1 package (see [http://patch-tracker.debian.org/package/sqlite3/3.7.13-1|debian specific patch information for this package]) for Debian testing on an x86 architecture, without modifications.

The following script illustrates the problem:
<verbatim>
.header on

create table tbl1 (col1 text primary key);

insert into tbl1 values ('123456');
insert into tbl1 values ('abcdef');
insert into tbl1 values ('äöüäöü');

select col1 from tbl1;
select substr(col1, 1, 4) as col1 from tbl1;

.mode column
select col1 from tbl1;

.width 4
select col1 from tbl1;
</verbatim>


Script output:
<verbatim>
col1
123456
abcdef
äöüäöü

col1
1234
abcd
äöüä

col1      
----------
123456    
abcdef    
äöüäö

col1
----
1234
abcd
äö
</verbatim>

Regards,

Stéphane Aulery

Attachments: