You are here: Re: ascii or binary « PHP Programming Language « IT news, forums, messages
Re: ascii or binary

Posted by Jerry Stuckle on 03/14/06 14:06

Kimmo Laine wrote:
> "greg" <greg@no-spam.org> wrote in message
> news:44166b72$0$7933$636a55ce@news.free.fr...
>
>>>In a sense he is right, it is not really straightforward to make the
>>>distinction, if you strictly mean the ascii character set.
>>>
>>>Binary just means that it consists of binary patterns or sequence of
>>>bits, varied in length and meaning. The content of a binary file only
>>>makes sense to an application which knows what the sequence of bits
>>>means. When a file is viewed in a text-editor, then the data is (possibly
>>>mistakenly) chopped up in 8-bits (or whatever), and the corresponding
>>>symbol of that value is displayed, which may or may not make any sense at
>>>all. Strictly speaking, the only difference between ascii and non-ascii
>>>would be whether or not each chunk of bits is *intended* to correspond to
>>>a specific symbol in the Ascii character table.
>>>
>>>If you by ascii generally mean plain readable/printable text, not
>>>necessarilly limited to ascii, then there is tools that could help you.
>>>
>>>http://dk2.php.net/mime_content_type
>>>http://pecl.php.net/package/fileinfo
>>>
>>>If you are on a linux/unix, check:
>>>http://www.freebsd.org/cgi/man.cgi?query=file
>>>
>>>You could just ignore the subtype, and only distinguish on mediatype
>>>between text and everything else.
>>>
>>>/Bent
>>
>>Thank you for these explanations.
>>In fact, I should have told why I want know make the difference between
>>ascii and binary files.
>>I have a list of files to send via FTP from a local machien to a remote
>>server.
>>the ftp_put function needs an argument that can be FTP_ASCII or
>>FTP_BINARY.
>>I don't know how to choose dynamicaly this argument as the must upload
>>various file types.
>
>
>
> I suppose you could just send binary always.
>

No, that will screw up the file if you're going between different OS's
such as Windows and Unix. There's a reason why there are different
transfer modes!

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex@attglobal.net
==================

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация