开发者

What characters are allowed in a file?

开发者 https://www.devze.com 2023-02-17 17:38 出处:网络
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

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

精彩评论

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

关注公众号