php-reports
php-reports copied to clipboard
Wrong value-display of utf-8 characters like Ö Ä Ü ß ö ä ü ... in the report-table
the value-display of the characters Ö Ä Ü ß ö ä ü ...
looks that way in the report-table:
äöü ��� & �
(In the mysql-table all tables/values are in utf-8)
solve the problem by editing the file: => php-reports / lib / PhpReports / ReportValue.php => line ~71
old:
elseif($type === 'string') {
return utf8_encode($value);
}
new:
elseif($type === 'string') {
if (mb_check_encoding($value, 'UTF-8')) return $value = utf8_encode($value);
else return $value;
}
after that change i get the a correct display of that values: äöü ÄÜÖ & ß
Maybe the changed lines should be checked into the trunk or the problem should be solved an other way.
regards, greq
Thank your for share, with your report I could find a solution too.
Your proposal solution did not works for me, the reason is that my data is already stored as UTF-8, so no need conversion.
I commented the line // return utf8_encode($value);
and replace by return $value;
before: "à obrigatória a informação"
after: "É obrigatória a informação"
Hi cesarliws,
you right about that my first workaround/solution didn't work, i forgot to use "false" in the if-statement:
elseif($type === 'string') {
if ( false === mb_check_encoding($value, 'UTF-8') ) return $value = utf8_encode($value);
else return $value;
}
regards, greq
Hi greq7,
Now it works.
[]s
Cesar
Sorry with my english, but.. I have tables with utf8 default collation encode and they values doesn't show in my php report (connected with a mysql database) because they have a symbols (like accents). Any idea what to modify in the file ReportValue, for resolve that?
just to elaborate. I have a database that is already encoded in UTF-8, but instead of getting wierd caracters in my reports, I get blank fields. And only on those texts that have accents, such as á, é, ó, etc. I have followed all your tips left by cesarliws and gregq7, but no good :(. Any ideas as to what it could be?
Hi, can someone solve this problem ?
thx for pointing this out @greq7
furthermore i had to to insert into Report.php after line 333
if ( false === mb_check_encoding($key, 'UTF-8') ) $key = utf8_encode($key);
if ( false === mb_check_encoding($option, 'UTF-8') ) $option = utf8_encode($option);
probably there is an encoding issue with the template engine in general...
That fixed the problem with greek characters in the table, do you know how to fix the X axis text in charts? I see Διάφ&omi… and not greek words