I am exporting data through files. The output is base64 encoded data.
$data = base64_encode(serialize($data));
Which results in something like:
bGFzcyI6MTp7czo1OiJzZXR1cCI7YTo3Mzp7czoyNToicGFnZXNfY29udGFjdF91c19oZWFkbGlu
So I am wondering what charset is more suitable for this data (plain text). us-ascii seems enough but utf-8 always seems an error-proof default.
header('content-type: text/plain; charset=utf-8');
It really doesn’t matter; your content is valid
US-ASCII, validUTF-8, validISO-8859-1(or, I believe, anyISO-8859-x), validWindows-1252, and so on. Just don’t putUTF-16orEBCDICor something.(For what it’s worth, I’d go with
US-ASCII, because it’s fully supported by even pre-Unicode computers without being so explicitly a pre-Unicode character-set asISO-8859-1or whatnot; but that’s really a subjective preference.)