Hiho,

 

I resolved the problem.

 

First in the common.php I encode the string first to utf8 before decoding with 
json_decode:

 

    public static function parseJSON($input, $decode=1) 

    {

        if (extension_loaded('json')) {

            if ($decode) {

                return json_decode(utf8_encode($input));

            } else {

                return json_encode($input);

            }

        } else {

            require_once($_SESSION['PM_INCPHP'] . "/extlib/json.php");

            $json = new Services_JSON();

            if ($decode) {

                return json_decode(utf8_encode($input));

            } else {

                return $json->encode($input);

            }

        }

    }

 

Then, in the export.FORMAT.php the strings have to be decoded. (i.e.: 
export.xls.php)

 

            $headerList = $grp->header; 

            $hL = count($headerList);

            $col = 0;

            for ($hi=0; $hi < $hL; $hi++) {

                $headline = $headerList[$hi];

                if ($headline == "@") {

                    //$col--;

                } else {

                    $worksheet->write($r, $col, utf8_decode($headline), 
$format_bold);

                    $col++;

                }

            }

            $r++;

            

            $values = $grp->values; 

            

            foreach ($values as $vList) {

                $vcol = 0;

                foreach ($vList as $v) {

                    // Links

                    if (is_object($v)) {

                        if (isset($v->shplink)) {

                        

                        }

                        

                        if (isset($v->hyperlink)) {

                            $worksheet->write($r, $vcol, $v->hyperlink[2]);     
      

                            $vcol++;

                        }

                    } else {

                        if (is_string($v)) {

                                               $worksheet->writeString($r, 
$vcol, utf8_decode($v));

                               } else {

                               $worksheet->write($r, $vcol, $v);

                               } 

                        $vcol++;

                    }

                }

                $r++;

            }

            

            $r++;

        }

 

Gruss

Thomas

 

Von: Thomas Andres 
Gesendet: Mittwoch, 10. März 2010 16:14
An: 'pmapper-users@lists.sourceforge.net'
Betreff: Exportproblem with Charset ISO-8859-1

 

Hi,

 

 

In /pmapper/locale/language_de.php I've written the translation for german, 
with  the special characters.

They are displayed well in the legend.

 

$_sl['Area'] = 'Fläche';

 

...now, when I select polygone features I have an attribute column named 
'Fläche', with the special  character 'ä'.

This is working fine,... but, when I export this data to excel nothing is 
displayed.

 

In export.xls.php the foreach ($groups as $grp) {} is false (not executed) at 
the first time. This means that

$groups = (array)$this->jsonList[0] is empty.

 

Wenn ich define Area with another character, the export is working well.

 

$_sl['Area'] = 'Flaeche';

 

What  could be the problem?

 

Thx, Thomas

 

------------------------------------------------------------------------------
Download Intel&#174; Parallel Studio Eval
Try the new software tools for yourself. Speed compiling, find bugs
proactively, and fine-tune applications for parallel performance.
See why Intel Parallel Studio got high marks during beta.
http://p.sf.net/sfu/intel-sw-dev
_______________________________________________
pmapper-users mailing list
pmapper-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/pmapper-users

Reply via email to