AvroCsvBundle icon indicating copy to clipboard operation
AvroCsvBundle copied to clipboard

Encoding problem

Open robiinho opened this issue 11 years ago • 0 comments

Hello,

i was in front of an encoding problem,

the CSV file was in ISO so i had an error An exception has been thrown during the rendering of a template ("Warning: htmlspecialchars() [function.htmlspecialchars]

So in : Util/Reader.php Line 45

I edited the function getRow() as following :

       public function getRow() {
    if (($row = fgetcsv($this->handle, 1000, $this->delimiter, $this->enclosure)) !== false) {
        $this->line++;

        //tweak 
        foreach ($row as $key => $value) {

            $row[$key] = json_decode(
                    json_encode(
                            iconv(
                                    mb_detect_encoding($value, mb_detect_order(), true), 'UTF-8', $value
                            )
                    ), true
            );
        }
        //fin tweak

        return $row;
    } else {
        return false;
    }
}

robiinho avatar Sep 17 '14 15:09 robiinho