开发者

What characters are allowed in a file?

I am using a PHP script to write compressed data to a txt file. The data could include any of the 255 ASCII characters. On asciitable.com, there is a character for file seperator (28). I want to know if it will cause trouble if a file seperator, or any special character, is written to a file.

EDIT: Tested on Wampse开发者_JAVA百科rver on windows, and adding a file separator to a file works fine.


I don't see why it should cause a problem. But since you're outputting binary data which isn't meant to be human-readable, there's no need to use a text file (and it's even arguably misleading).

Were you hoping to read the compressed data in a text editor for debugging purposes? Because if you are, you should be wary of the fact that different text editors handle non-printable control characters in different ways. My version of Notepad displays nothing for a file-separator character while Notepad++ displays an FS symbol. And based on my experiences in viewing data output from a machine, there's even variance between different versions of Notepad. You should really use a hex editor to view it.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜