作者rockpower ()
看板EzHotKey
标题Re: [-AI-] SQLite 与 utf-8 中文的问题
时间Sat Jan 24 21:52:15 2009
刚刚感谢 ward 版友的帮忙找到答案了
_SQLite_FetchData 要加第三个参数设成 binary mode 才可以
所以 code 改成下面这样就可以正常读取中文了
#include <SQLite.au3>
#include <SQLite.dll.au3>
Local $hQuery, $aRow, $path
$path = @ScriptDir & "\tmp.sqlite"
_SQLite_Startup ()
_SQLite_Open ($path)
_SQLite_Exec (-1, "PRAGMA encoding = 'UTF-8';")
_SQlite_Query (-1, "SELECT * FROM data;", $hQuery)
While _SQLite_FetchData ($hQuery, $aRow,
1) = $SQLITE_OK
$aRow[1] = BinaryToString($aRow[1], 4)
ConsoleWrite($aRow[0] & " | " & $aRow[1] & @CRLF)
WEnd
_SQLite_Close()
_SQLite_Shutdown()
--
※ 发信站: 批踢踢实业坊(ptt.cc)
◆ From: 59.115.182.164