Take the 2-minute tour ×

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 Wampserver on windows, and adding a file separator to a file works fine.

share|improve this question
There are 128 ASCII characters (including NUL), not 255. Do you mean you're writing arbitrary binary data to a file with the extension .txt? That would be lying. –  larsmans Mar 19 '11 at 21:43
Asciitable.com says that characters 128-255 are extended ascii codes. –  Joel Mar 19 '11 at 21:48
well, then that website is wrong. ASCII does not define anything called "extended ASCII". The interpretation of values 128-255 (which makes a total of 256, not 255) is totally independent of ASCII and many different and incompatible interpretations exist. en.wikipedia.org/wiki/Extended_ASCII –  larsmans Mar 19 '11 at 21:51
I checked wikipedia, and I think you're right. Ascii is only defined to be 128 characeters. Thanks. –  Joel Mar 19 '11 at 21:58
add comment

1 Answer

up vote 1 down vote accepted

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.

share|improve this answer
I just thought that maybe the server's filesystem uses the file separator character to separate files on the hard drive. –  Joel Mar 19 '11 at 21:43
Nah, FS isn't used for that purpose. In fact, I've never seen an app which uses that character. I'm updating my answer now. –  Nathan Pitman Mar 19 '11 at 21:51
I think FS is a remnant of 1960's operating systems. I'd never even heard of it until now. –  larsmans Mar 19 '11 at 22:00
ASCII is an ancient (1960s, IIRC) and defunct character set. FS was useful for batch processing systems and block-mode terminals back then, but has no standard meaning in modern systems. –  geekosaur Mar 19 '11 at 22:02
add comment

Your Answer


