Symfony生成CSV字符错误

时间:2014-12-03 13:55:41

标签: php symfony csv character-encoding

我正在使用以下代码在Sympony 2.0中生成CSV文件。

    $filename = "file.csv";
    $response = $this->render('propesqBundle:Relatorio:' . $session->get('idRelatorio' . $key) . '.csv.html.twig', array('rows' => $session->get('resultado' . $key)));
    $response->headers->set('Content-Type', 'Content-type: application/octet-stream; charset=UTF-8');
    $response->headers->set('Content-Disposition', 'attachment; filename=' . $filename);
    return $response;

但是,当我打开文件时,单词&替换为&,单引号'替换为'

0 个答案:

没有答案