Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

International characters in usernames are not shown correctly #2

Open
mikini opened this issue Oct 26, 2017 · 1 comment
Open

International characters in usernames are not shown correctly #2

mikini opened this issue Oct 26, 2017 · 1 comment

Comments

@mikini
Copy link

mikini commented Oct 26, 2017

I have usernames in Redmine containing Danish ø (HTML ) and å (HTML ) which ends up being wrongly formatted on the Munin graphs.

Output from MySQL and hence the plugin seems to be correct utf-8, they are interpreted fine by my shell but munin-graph doesn't render them correctly.

utf-8 char html entity hex Munin png representation
ø ø (ø) c3 b8 screenshot from 2017-10-26 16-47-29
å å (å) c3 a5 screenshot from 2017-10-26 16-47-39

According to the Munin docs (wiki) any chars except # and \ should be valid but no expected charset is specified. I have tried to dig into the perl code to see where and how the png are generated but haven't got to the bottom of it.

The rendered chars seems to be consistent with the 8859-1 codepage/charset. However, I do not get the expected result when changing the encoding from the current utf-8 to iso-8859-1 in line 108-109 as below. Now instead of the expected 0xf8 for ø in 8859-1 a value of 0x72 is output, for å (0xe5 in 8859-1) a value of 0x73.

diff --git a/redmine_stat.py b/redmine_stat.py
old mode 100644
new mode 100755
index 731f442..7ff8acd
--- a/redmine_stat.py
+++ b/redmine_stat.py
@@ -105,8 +105,8 @@ class TicketsByOwner(RedmineBase):
 
         def row(item):
             print "_v%s.label %s %s" % (item[3],
-                                        unicode(item[1]).encode("utf-8"),
-                                        unicode(item[2]).encode("utf-8"))
+                                        unicode(item[1]).encode("iso-8859-1"),
+                                        unicode(item[2]).encode("iso-8859-1"))
             print "_v%s.draw AREASTACK" % (item[3])
 
         self._result(row)

mikini added a commit to VestergaardCompany/redmine_stats that referenced this issue Oct 26, 2017
Encode usernames in labels of user_* graphs using 8859-1 encoding
as Munin expects.

Refer also to saily#2.
@mikini
Copy link
Author

mikini commented Oct 26, 2017

Sorry, I misread the raw output from the plugin and label updating on the website graphs seems to be delayed some cycles.

The above patch correctly encodes the usernames. Tested using Munin 2.0.25 from Ubuntu 16.04 LTS. I have committed the change to a fork at https://github.com/VestergaardCompany/redmine_stats and requested a pull in #3.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant