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

How can I output a UTF-8 CSV that Excel will read properly? #132

Open
KenDzz opened this issue Aug 4, 2021 · 1 comment
Open

How can I output a UTF-8 CSV that Excel will read properly? #132

KenDzz opened this issue Aug 4, 2021 · 1 comment
Labels

Comments

@KenDzz
Copy link

KenDzz commented Aug 4, 2021

https://imgur.com/BD1V12I

$_csvEncoding= 'UTF-8';
        $_dataEncoding = 'UTF-8';
        $_newline = "\r\n";
        $_eol = "\r\n";
        $_bom = true;
        $timestamp = time();
        $this->response = $this->response->withDownload('test-'.$timestamp.'.csv');
        $this->set(compact('data', '_dataEncoding' ,'_csvEncoding', '_newline', '_eol', '_bom'));
        $this->viewBuilder()
        ->setClassName('CsvView.Csv')
        ->setOptions([
            'serialize' => 'data',
            'header' => $header,
'extract' => $extract,
]);

It doesn't work.
someone please help me!

Thank you

@Tatsurou-Yajima
Copy link

@KenDzz
How about trying to add a BOM to the CSV file?

How to do this is described in the following article.

https://yajimaga-tech-blog.vercel.app/posts/20230817

It is written in Japanese, so please translate if necessary.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants