Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Encoding problem #16

Open
robiinho opened this issue Sep 17, 2014 · 0 comments
Open

Encoding problem #16

robiinho opened this issue Sep 17, 2014 · 0 comments

Comments

@robiinho
Copy link

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;
    }
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant