From 70dcff6b3d681bbeae4b9536139426d6d60a46bd Mon Sep 17 00:00:00 2001 From: Andrew Dolgov Date: Fri, 17 Aug 2007 17:02:15 +0100 Subject: [PATCH] mysql: set connection charset to utf-8 --- backend.php | 3 +++ opml.php | 3 +++ update.php | 5 ++++- update_daemon.php | 3 +++ update_feeds.php | 3 +++ xml-rpc.php | 3 +++ 6 files changed, 19 insertions(+), 1 deletion(-) diff --git a/backend.php b/backend.php index 24f3bba3..c5757a2f 100644 --- a/backend.php +++ b/backend.php @@ -49,6 +49,9 @@ if (DB_TYPE == "pgsql") { pg_query("set client_encoding = 'UTF-8'"); pg_set_client_encoding("UNICODE"); + } else { + db_query($link, "SET NAMES utf8"); + db_query($link, "SET CHARACTER SET utf8"); } $op = $_REQUEST["op"]; diff --git a/opml.php b/opml.php index b1a62ab8..ac236a64 100644 --- a/opml.php +++ b/opml.php @@ -13,6 +13,9 @@ if (DB_TYPE == "pgsql") { pg_query($link, "set client_encoding = 'utf-8'"); pg_set_client_encoding("UNICODE"); + } else { + db_query($link, "SET NAMES utf8"); + db_query($link, "SET CHARACTER SET utf8"); } login_sequence($link); diff --git a/update.php b/update.php index 8daacc96..e15e3be0 100644 --- a/update.php +++ b/update.php @@ -13,8 +13,11 @@ if (DB_TYPE == "pgsql") { pg_query($link, "set client_encoding = 'utf-8'"); pg_set_client_encoding("UNICODE"); + } else { + db_query($link, "SET NAMES utf8"); + db_query($link, "SET CHARACTER SET utf8"); } - + login_sequence($link); $owner_uid = $_SESSION["uid"]; diff --git a/update_daemon.php b/update_daemon.php index b7a51168..25ef6a99 100644 --- a/update_daemon.php +++ b/update_daemon.php @@ -65,6 +65,9 @@ if (DB_TYPE == "pgsql") { pg_query("set client_encoding = 'utf-8'"); pg_set_client_encoding("UNICODE"); + } else { + db_query($link, "SET NAMES utf8"); + db_query($link, "SET CHARACTER SET utf8"); } $last_purge = 0; diff --git a/update_feeds.php b/update_feeds.php index 32635b82..aa07321e 100644 --- a/update_feeds.php +++ b/update_feeds.php @@ -26,6 +26,9 @@ if (DB_TYPE == "pgsql") { pg_query("set client_encoding = 'utf-8'"); pg_set_client_encoding("UNICODE"); + } else { + db_query($link, "SET NAMES utf8"); + db_query($link, "SET CHARACTER SET utf8"); } $result = db_query($link, "SELECT id FROM ttrss_users"); diff --git a/xml-rpc.php b/xml-rpc.php index 8c65123f..d61382c0 100644 --- a/xml-rpc.php +++ b/xml-rpc.php @@ -22,6 +22,9 @@ if (DB_TYPE == "pgsql") { pg_query("set client_encoding = 'utf-8'"); pg_set_client_encoding("UNICODE"); + } else { + db_query($link, "SET NAMES utf8"); + db_query($link, "SET CHARACTER SET utf8"); } function getVirtualFeeds($msg) { -- 2.39.5