php-reports icon indicating copy to clipboard operation
php-reports copied to clipboard

Wrong value-display of utf-8 characters like Ö Ä Ü ß ö ä ü ... in the report-table

Open greq7 opened this issue 10 years ago • 8 comments

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

greq7 avatar Oct 22 '13 13:10 greq7

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"

cesarliws avatar Feb 12 '14 23:02 cesarliws

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

greq7 avatar Mar 05 '14 08:03 greq7

Hi greq7,

Now it works.

[]s

Cesar

cesarliws avatar Mar 07 '14 04:03 cesarliws

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?

cpavon89 avatar Apr 30 '14 20:04 cpavon89

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?

cpavon89 avatar Apr 30 '14 20:04 cpavon89

Hi, can someone solve this problem ?

ecarambia avatar Jun 15 '15 12:06 ecarambia

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

webermax avatar Feb 15 '16 09:02 webermax

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

geo782 avatar Jan 11 '18 11:01 geo782