1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40
|
Description: Use UTF-8 while creating database and RRD files
Author: Slavko <linux@slavino.sk>
Bug-Debian: http://bugs.debian.org/604395
Forwarded: http://bugs.cacti.net/view.php?id=1981
Last-Update: 2012-05-01
Index: cacti/lib/database.php
===================================================================
--- cacti.orig/lib/database.php
+++ cacti/lib/database.php
@@ -50,6 +50,7 @@ function db_connect_real($host, $user, $
while ($i <= $retries) {
$cnn_id = ADONewConnection($dsn);
if ($cnn_id) {
+ $cnn_id->EXECUTE("set names 'utf8'");
return($cnn_id);
}
Index: cacti/lib/rrd.php
===================================================================
--- cacti.orig/lib/rrd.php
+++ cacti/lib/rrd.php
@@ -1050,7 +1050,7 @@ function rrdtool_function_graph($local_g
if ($graph["auto_padding"] == "on") {
/* only applies to AREA, STACK and LINEs */
if (preg_match("/(AREA|STACK|LINE[123])/", $graph_item_types{$graph_item["graph_type_id"]})) {
- $text_format_length = strlen($graph_variables["text_format"][$graph_item_id]);
+ $text_format_length = mb_strlen($graph_variables["text_format"][$graph_item_id], 'UTF-8');
if ($text_format_length > $greatest_text_format) {
$greatest_text_format = $text_format_length;
@@ -1294,7 +1294,7 @@ function rrdtool_function_graph($local_g
if ((!isset($graph_data_array["graph_nolegend"])) && ($graph["auto_padding"] == "on")) {
/* only applies to AREA, STACK and LINEs */
if (preg_match("/(AREA|STACK|LINE[123])/", $graph_item_types{$graph_item["graph_type_id"]})) {
- $text_format_length = strlen($graph_variables["text_format"][$graph_item_id]);
+ $text_format_length = mb_strlen($graph_variables["text_format"][$graph_item_id], 'UTF-8');
/* we are basing how much to pad on area and stack text format,
not gprint. but of course the padding has to be displayed in gprint,
|