SQLite Forum

bug report: -init, .read run batch INSER INTO error in UTF-16le, UTF-16be table
Login
Hi, I downloaded sqlite 3.33.0 recently.

my operating system is Simplified Chinese WinXP + 203 hotfixes.<br>
<br>
in sqlite 3.33.0, I insert some text including Simplified Chinese Characters into UTF-16 table, using 4 INSERT INTO commands,<br>
but Simplified Chinese Character displayed error.<br>

suppose import.sql is ANSI encoding, its contents like:<br>
<br>
pragma encoding='utf-16le';<br>
create table test (name, age integer);<br>
insert into test values ('tom', 10);<br>
insert into test values ('jerry', 20);<br>
insert into test values ('张三', 30);<br>
insert into test values ('李四', 40);<br>
select * from test;<br>
<br>

1. suppose database utf16le.db not exist, now run below command on command prompt,<br>
<br>
C:\>sqlite3.exe -init import.sql utf16le.db ".exit"<br>
-- Loading resources from import.sql<br>
tom|10<br>
jerry|20<br>
????|30&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;; Chinese displayed error, bug.<br>
????|40&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;; Chinese displayed error, bug.<br>
<br>
same bug in UTF-16be table.<br>
<br>

2. suppose database utf16le.db not exist, now run below command,<br>
C:\>sqlite3.exe utf16le.db<br>
sqlite> .read import.sql<br>
bug is same as above.<br>
<br>
same bug in UTF-16be table.<br>
<br>

note: sqlite 3.10.0 has no this bug.<br>

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