Csv export name uncommon words change question mark csv export data
In the user name column, several user names with uncommon characters are changed to "?", The Chinese names of most users are OK,
Iconv ("UTF-8", "GBK", $ username); has no effect on uncommon words before export.
Uncommon words such as "?", "?", "?", "?"
Reply to discussion (solution)
"?", "?", "?", "?" It is not uncommon to say that GBK has already been made.
Ci Hai has more than 10 million words, and GBK has recorded more than 20 thousand points
You specified the GB2312 character set somewhere.
Estimate? Are other character sets used? To.
Csv exported data
In the user name column, several user names with uncommon characters are changed to "?", The Chinese names of most users are OK,
Iconv ("UTF-8", "GBK", $ d-> realname) before export; but has no effect on uncommon words.
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;
If the problem is found, the exported keyword on the mac server becomes a question mark, and the export is normal in windows.
I don't know how your classes are written. just test it.
Header ("Content-type: text/csv; charset = gb2312"); header ("Content-Disposition: attachment; filename=....csv"); echo '"? ","? ","? ","? "';
No problem