开发者

php writing text file creation format

I need to store some data in a text file. The data is in my mysql as lat开发者_开发问答in1 to use as few bytes as possible. How can I make a text file for php to write to in latin1 format please?


Whilst slightly off-topic, to be honest I'd be tempted to keep everything (web page, database connection, table/collation, output files, etc. in UTF-8), purely in the (quite possibly epically unlikely) eventuality that non latin1 characters are required at any point in the future.

Virtually all text editors, etc. support UTF-8 as-is and it'll be easier to convert from UTF-8 to another format (and conversely from another format to UTF-8) if so required. Additionally, database (and disk space) is ridiculously cheap, so using up a few bytes here and there in comparison to committing to a limited character set would seem a bit of an excessive trade-off.

Incidentally, there's a fairly canonical blog post related to such things by Joel Spolsky called: "The Absolute Minimum Every Software Developer Absolutely, Positively Must Know About Unicode and Character Sets (No Excuses!)". It's well worth a read irrespective of which way you decide to go.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜