Skip to content

Instantly share code, notes, and snippets.

@xfenix
Created October 4, 2012 12:08
Show Gist options
  • Save xfenix/3833193 to your computer and use it in GitHub Desktop.
Save xfenix/3833193 to your computer and use it in GitHub Desktop.
CSV cross-platform generation (utf-16le)
header("Cache-Control: must-revalidate");
header("Pragma: must-revalidate");
header("Content-type: application/vnd.ms-excel; charset=URF-16LE");
header("Content-disposition: attachment; filename=file.csv");
echo chr( 0xFF ) . chr( 0xFE ) . mb_convert_encoding( $content, 'UTF-16LE', 'UTF-8' );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment