批处理文件在sqlite中使用西里尔字体插入不正确的数据

时间:2012-05-10 08:16:00

标签: sqlite encoding batch-file

我有一个简单的批处理,它将特定的记录插入到sql db:

set /P theuserinput="Enter the filename: "
sqlite3 test "insert into films (title, date, start_time) values ('%theuserinput%', '%date%', '%time%');" 

它适用于拉丁文件名,但当我尝试使用西里尔文件名时,会插入一些不可读的字符。

事实证明它工作正常,我只需要查看SQLite Maestro中的那些西里尔语记录,而不是sqlite3

1 个答案:

答案 0 :(得分:0)

您可以尝试在将sqlite插入执行到西里尔文pgae之前更改代码页chcp 855

或65001 UTF-8,但是你需要阻止你的命令

set /P theuserinput="Enter the filename: "
(
  chcp 65001
  sqlite3 test "insert into films (title, date, start_time) values ('%theuserinput%', '%date%', '%time%');" 
  chcp 850
)