SQLite UTF-8编码 [英] SQLite UTF-8 encoding

查看:818
本文介绍了SQLite UTF-8编码的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我尝试运行具有UTF-8字符串的脚本(.read FILE).我使用了pragma命令:

I try to run script (.read FILE) that has UTF-8 strings. I used pragma command:

PRAGMA encoding="UTF-8";

但是我弄错了字符. 如果我自己创建表并插入值,则一切正常.我应该怎么做才能正确运行脚本?

But I get wrong characters. If I create table and insert values by myself, everything works right. What should I do to run script properly?

顺便说一句,我检查了很多关于stackoverflow和其他资源的问题/文章,并阅读了文档.我尝试了一些方法,例如,在Windows cmd中使用chcp 65001,然后在当前窗口中打开sqlite3.但这没有帮助.

By the way, I checked a lot of questions/articles on stackoverflow and other resources + read documentation. I tried some methods, for example, to use chcp 65001 in Windows cmd and then opened sqlite3 in current window. But it didn't help.

推荐答案

所有您需要做的是:

  1. 打开cmd并更改编码(chcp 65001)

从当前窗口运行sqlite3.exe

Run sqlite3.exe from current windows

更改编码(PRAGMA encoding="UTF-8";)

创建正确的UTF-8脚本.

Create correct UTF-8 script.

这篇关于SQLite UTF-8编码的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆