LoginSignup
2
0

More than 5 years have passed since last update.

Symfony 2.7.3 SonataAdmin CSV文字化け FIX

Last updated at Posted at 2018-07-04
sonata-project/exporter/lib/Exporter/Writer/CsvWriter.php
    /**
     * {@inheritdoc}
     */
    public function write(array $data)
    {
        if ($this->position == 0 && $this->showHeaders) {
            $this->addHeaders($data);

            ++$this->position;
        }

        mb_convert_variables('SJIS-win', 'UTF-8', $data); // 追加

        $result = @fputcsv($this->file, $data, $this->delimiter, $this->enclosure);

        if (!$result) {
            throw new InvalidDataFormatException();
        }

        ++$this->position;
    }
2
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
2
0