From edd70257ade66aab530fc787d95506fa151d5627 Mon Sep 17 00:00:00 2001
From: Thomas Hooge <thomas@hoogi.de>
Date: Wed, 12 Dec 2018 14:00:19 +0100
Subject: [PATCH] Characterset improvements: using UTF-8 and encoding chars

---
 plugin.info.txt | 4 ++--
 syntax.php      | 4 ++--
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/plugin.info.txt b/plugin.info.txt
index f89c1e5..5635d27 100644
--- a/plugin.info.txt
+++ b/plugin.info.txt
@@ -1,7 +1,7 @@
 base   sqlquery
 author George Pirogov
 email  i1557@yandex.ru
-date   2018-12-10
-name   SQL query plugin
+date   2018-12-12
+name   SQL query plugin (multidb)
 desc   Processing query to mysql database and display results as a table.
 url    https://www.dokuwiki.org/plugin:sqlquery
diff --git a/syntax.php b/syntax.php
index 7bc0c75..8c415e9 100644
--- a/syntax.php
+++ b/syntax.php
@@ -85,7 +85,7 @@ class syntax_plugin_sqlquery extends DokuWiki_Syntax_Plugin {
         $password = $this->getConf('password');
 
         // connect to database
-        $dsn = "{$data['type']}:host={$data['host']};dbname={$data[db]}";
+        $dsn = "{$data['type']}:host={$data['host']};dbname={$data[db]};charset=UTF-8;";
         try {
             $dbh = new PDO($dsn, $user, $password);
         } catch (PDOException $e) {
@@ -126,7 +126,7 @@ class syntax_plugin_sqlquery extends DokuWiki_Syntax_Plugin {
             $renderer->doc .= "<tr>";
             for ( $i = 0; $i < $fieldcount; $i++ ) {
                 $renderer->doc .= "<td>";
-                $renderer->doc .= $row[$i];
+                $renderer->doc .= htmlentities($row[$i]);
                 $renderer->doc .= "</td>";
             }
             $renderer->doc .= "</tr>\n";