sqlite导入Mac
我在将数据导入 sqlite 数据库时遇到问题。
我是这样的:
- 我从 PHP 脚本收到
INSERT
查询,该脚本读取*.csv
文件,然后进行分析(删除空格,从地址进行地理编码.. .) - 查询本身很好并且语法正确
- 返回查询的字符集是UTF-8(并且正确显示)
- 尝试使用
sqlite3database.sqlite
在Mac(OS X Snow Leopoard)上导入终端 - 导入本身很好 - 但在德语变音符号(ä、ü、ö、ß...)上,数据会重复自身而不是显示变音符号(例如“Seeblickstraße”插入为“SeeblickstraSeeblickstrae”)...
来自的编码数据库已经是 UTF-8
- 看起来这是终端的问题...当我在终端上按“ß”(仅在 sqlite3
中)时,它会重复最后输入...
预先感谢您的帮助!
I've a problem importing data into a sqlite database.
I go like this:
- I receive the
INSERT
queries from a PHP script, which reads a*.csv
file and then gets analyzed (remove whitespaces, make geocoding from address ...) - The queries theirself are just fine and syntactically correct
- The charset of the returned queries are UTF-8 (and are shown properly)
- Trying to import on Mac (OS X Snow Leopoard) with
sqlite3 database.sqlite
on Terminal - Import itself is FINE - but on german umlauts (ä, ü, ö, ß...) the data repeats itself instead of showing the umlaut (e.g. "Seeblickstraße" is inserted as "SeeblickstraSeeblickstrae")...
The encoding from the database is already UTF-8
- it looks like it's a problem with the Terminal though... when I press "ß" on Terminal (just in sqlite3
) it repeats the last input...
Thanks in advance for your help!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我尝试了一些不同的方法,发现问题出在 Mac 终端上。我尝试将查询复制到我的服务器上的 sqlite 数据库(还有
sqlite3
、CentOS 5.5)中,结果一切顺利。因此,为了复制查询,我现在使用 Firefox 的 SQLite Manager 扩展。这不是我想要的方式,但看起来这是在 Mac 上完成它的唯一(快速)方式(目前对我来说)。
I tried some different things and discovered that the problem is just within the Terminal @ Mac. I tried to copy the queries into an sqlite database on my server (also
sqlite3
, CentOS 5.5) and went just fine.So - for copying the queries I use now the SQLite Manager extension with Firefox. It is not the way I wanted to do it but it looks like it is the only (fast) way to accomplish it on Mac (for me at the moment).
您还可以尝试将
INSERT
语句保存到文件中,然后从 sqlite3 命令行调用.read
。我过去也遇到过类似的问题,我发现在终端中粘贴 UTF-8 字符效果不太好,但是当我使用.read
语句时,它就解决了。You could also try saving your
INSERT
statement to a file, then calling the.read <yourfile>
from your sqlite3 command line. I've had similar problems in the past and I found pasting UTF-8 characters in the terminal did not work very well, but when I used the.read
statement, it worked out.