SQLite Forum

null character sorts greater than 0x7f and less than 0x80
Login
I don't see how that is so.  I carefully read both of the Wikipedia articles to which I linked, and also verified that Tcl acts as claimed. It uses the overlong nul form internally and outputs or inputs the canonical standard form for file (or stream) I/O. Here is some code with which that can be seen:<code>
package require sqlite3
sqlite3 db nullch.sdb
db eval {
    create table if not exists t (
	id integer primary key,
        k integer,
        v text
    )
}
set ofh [open nullch.txt w]
\# degree, rubout, nul
foreach val {
    °
    \x7f
    \x00
} {
    puts $ofh $val
    db eval {
        insert into t (k,v) values (1, $val)
    }
}
close $ofh
set ifh [open nullch.txt]
while {[gets $ifh lin] >= 0} {
    db eval {
        insert into t (k,v) values (2, $lin)
    }
}
close $ifh
db close
</code>
Examination of the nullch.txt and nullch.sdb files is left as an exercise.