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

Posted by Kimmo Laine on 03/14/06 10:41

"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.

--
"En ole paha ihminen, mutta omenat ovat elinkeinoni." -Perttu Sirviφ
spam@outolempi.net | Gedoon-S @ IRCnet | rot13(xvzzb@bhgbyrzcv.arg)

 

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

Π‘Π°ΠΉΡ‚ ΠΈΠ·Π³ΠΎΡ‚ΠΎΠ²Π»Π΅Π½ Π² Π‘Ρ‚ΡƒΠ΄ΠΈΠΈ Π’Π°Π»Π΅Π½Ρ‚ΠΈΠ½Π° ΠŸΠ΅Ρ‚Ρ€ΡƒΡ‡Π΅ΠΊΠ°
ΠΈΠ·Π³ΠΎΡ‚ΠΎΠ²Π»Π΅Π½ΠΈΠ΅ ΠΈ ΠΏΠΎΠ΄Π΄Π΅Ρ€ΠΆΠΊΠ° Π²Π΅Π±-сайтов, Ρ€Π°Π·Ρ€Π°Π±ΠΎΡ‚ΠΊΠ° ΠΏΡ€ΠΎΠ³Ρ€Π°ΠΌΠΌΠ½ΠΎΠ³ΠΎ обСспСчСния, поисковая оптимизация