Show
Ignore:
Timestamp:
05/29/11 11:08:27 (2 years ago)
Author:
Torben Brodt
Message:

try to fix problems with umlauts and iso encoding, see #539

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • g-map/files/lib/page/MapAjaxPage.class.php

    r1441 r1442  
    147147                         
    148148                        $username = $user->username; 
     149                         
     150                        // json encode can only use utf-8 
    149151                        if(CHARSET != 'UTF-8') { 
    150                                 $username = StringUtil::encodeHTML($username); 
     152                                $username = StringUtil::convertEncoding(CHARSET, 'UTF-8', $username); 
    151153                        } 
    152154                                         
     
    167169                parent::show(); 
    168170                 
    169                 // send header for corrent charset 
     171                // json encode can only use utf-8, thats why we converted all data before 
     172                $str = json_encode($this->datapoints); 
     173 
    170174                @header('Content-Type: application/json; charset='.CHARSET); 
    171                 echo json_encode($this->datapoints); 
     175                if(CHARSET != 'UTF-8') { 
     176                        echo StringUtil::convertEncoding('UTF-8', CHARSET, $str); 
     177                } else { 
     178                        echo $str; 
     179                } 
    172180        } 
    173181}