SQLite Forum

bug report: -init, .read run batch INSER INTO error in UTF-16le, UTF-16be table
Login

bug report: -init, .read run batch INSER INTO error in UTF-16le, UTF-16be table

(1) By anonymous on 2020-09-12 12:05:22 [source]

Hi, I downloaded sqlite 3.33.0 recently.

my operating system is Simplified Chinese WinXP + 203 hotfixes.

in sqlite 3.33.0, I insert some text including Simplified Chinese Characters into UTF-16 table, using 4 INSERT INTO commands,
but Simplified Chinese Character displayed error.

suppose import.sql is ANSI encoding, its contents like:

pragma encoding='utf-16le';
create table test (name, age integer);
insert into test values ('tom', 10);
insert into test values ('jerry', 20);
insert into test values ('张三', 30);
insert into test values ('李四', 40);
select * from test;

  1. suppose database utf16le.db not exist, now run below command on command prompt,

    C:>sqlite3.exe -init import.sql utf16le.db ".exit"
    -- Loading resources from import.sql
    tom|10
    jerry|20
    ????|30          ; Chinese displayed error, bug.
    ????|40          ; Chinese displayed error, bug.

    same bug in UTF-16be table.

  2. suppose database utf16le.db not exist, now run below command,
    C:>sqlite3.exe utf16le.db
    sqlite> .read import.sql
    bug is same as above.

    same bug in UTF-16be table.

note: sqlite 3.10.0 has no this bug.

in sqlite 3.10.0, run command like 1, 2, Chinese displayed normally.
see below command in above 2.
C:>sqlite3.exe utf16le.db
sqlite> .read import.sql
tom|10
jerry|20
张三|30          ; Chinese displayed normally, no bug in sqlite 3.10.0.
李四|40          ; Chinese displayed normally, no bug in sqlite 3.10.0.