Characterset improvements: using UTF-8 and encoding chars

multidb
Thomas Hooge 5 years ago
parent cea39b66c8
commit edd70257ad
  1. 4
      plugin.info.txt
  2. 4
      syntax.php

@ -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

@ -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";