Characterset improvements: using UTF-8 and encoding chars

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

@ -1,7 +1,7 @@
base sqlquery base sqlquery
author George Pirogov author George Pirogov
email i1557@yandex.ru email i1557@yandex.ru
date 2018-12-10 date 2018-12-12
name SQL query plugin name SQL query plugin (multidb)
desc Processing query to mysql database and display results as a table. desc Processing query to mysql database and display results as a table.
url https://www.dokuwiki.org/plugin:sqlquery url https://www.dokuwiki.org/plugin:sqlquery

@ -85,7 +85,7 @@ class syntax_plugin_sqlquery extends DokuWiki_Syntax_Plugin {
$password = $this->getConf('password'); $password = $this->getConf('password');
// connect to database // 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 { try {
$dbh = new PDO($dsn, $user, $password); $dbh = new PDO($dsn, $user, $password);
} catch (PDOException $e) { } catch (PDOException $e) {
@ -126,7 +126,7 @@ class syntax_plugin_sqlquery extends DokuWiki_Syntax_Plugin {
$renderer->doc .= "<tr>"; $renderer->doc .= "<tr>";
for ( $i = 0; $i < $fieldcount; $i++ ) { for ( $i = 0; $i < $fieldcount; $i++ ) {
$renderer->doc .= "<td>"; $renderer->doc .= "<td>";
$renderer->doc .= $row[$i]; $renderer->doc .= htmlentities($row[$i]);
$renderer->doc .= "</td>"; $renderer->doc .= "</td>";
} }
$renderer->doc .= "</tr>\n"; $renderer->doc .= "</tr>\n";