如何从PHP中将正确的UTF-8文本插入Sqlite3?

时间:2015-04-20 17:45:09

标签: php encoding utf-8 sqlite

我正在尝试直截了当的方式并且收到乱码:

注意:我在Windows 8.1上。

PHP

<?php
$db = new SQLite3(__DIR__ . "/txttest.db");
$db->exec("CREATE TABLE IF NOT EXISTS txttest (txt TEXT)");

$db->exec("DELETE FROM txttest");

$text = "ção";

$stmt = $db->prepare("INSERT INTO txttest (txt) VALUES (?)");
$stmt->bindParam(1, $text, SQLITE3_TEXT);
$stmt->execute();
?>

Git Bash

sqlite> select * from txttest;
ção

编辑:它实际上与sqlite3无关,但与Git Bash无关:Why does Git Bash not display my PHP strings correctly?

0 个答案:

没有答案