CSV-Exported data
User name This column, there are several users of the name of the rare word has become "?", most of the user's Chinese name is OK,
Iconv ("UTF-8", "GBK", $username), but no effect on uncommon characters.
Uncommon words such as "?", "?", "?", "?"
Reply to discussion (solution)
"?", "?", "?", "?" Since the income is GBK, it is not an uncommon word.
Hanyu da Zidian has more than 100,000 words, GBK only included more than 20,000 points
It's supposed to be somewhere where you specified the character set as GB2312.
Is the use of other character sets?
CSV-Exported data
User name This column, there are several users of the name of the rare word has become "?", most of the user's Chinese name is OK,
Iconv ("UTF-8", "GBK", $d->realname), but no effect on uncommon characters.
Uncommon words such as "?", "?", "?", "?"
foreach ($datas as $d)
{
$d->realname=iconv ("UTF-8", "GBK", $d->realname);
}
$contents = View::make (' user.info_csv ')->with (compact (' datas '));
$response = Response::make ($contents, 200);
$response->header (' Content-type ', ' text/csv;charset=gb2312 ');
$response->header (' content-disposition ', ' attachment; filename= ' user information. csv ');
return $response;
Find the problem, Mac machine export encountered uncommon word becomes question mark, Windows export Normal.
I don't know how your classes are written, just a simple test.
Header ("content-type:text/csv;charset=gb2312"); header ("Content-disposition:attachment; Filename= user information. csv "); Echo '"? ","? ","? ","? ";
And there's no problem.