{"id":1759,"date":"2011-01-02T23:13:50","date_gmt":"2011-01-02T12:13:50","guid":{"rendered":"http:\/\/mingersoft.com\/blog\/?p=1759"},"modified":"2012-10-24T09:20:14","modified_gmt":"2012-10-23T22:20:14","slug":"ftp-and-the-difference-between-ascii-and-binary-modes","status":"publish","type":"post","link":"https:\/\/mingersoft.com\/blog\/2011\/01\/ftp-and-the-difference-between-ascii-and-binary-modes\/","title":{"rendered":"FTP and the Difference Between ASCII and Binary Modes"},"content":{"rendered":"<p><strong>Edit: Thanks to Brian Layman for picking up some horrible errors on my part on the below \ud83d\ude42<\/strong><\/p>\n<p>A slightly more technical article for today.<\/p>\n<p>For those of you who use FTP every now and then along with FTP client software such as FileZilla or the command line FTP utility that comes with Windows you may have noticed that there are two file transfer methods, ASCII and binary. What you may not realise is the difference between these transmission types especially if the client software makes that determination for you.<\/p>\n<p>To break things down a bit, <a title=\"ASCII | Wikipedia\" href=\"http:\/\/en.wikipedia.org\/wiki\/ASCII\" target=\"_blank\">ASCII<\/a> stands for American Standard Code for Information Interchange which was used to define how text is represented in computers. ASCII included a mix of printable characters (such as letters, numbers and various symbols) and control characters that controlled how text and space was interpreted. When text was to be stored or transferred between computers it was done in ASCII format.<\/p>\n<p>Conversely, the term &#8220;binary file&#8221; is a fancy name for a file that\u00a0contains\u00a0executable code (i.e. it is an application or part of an application such as a DLL file). If you happened to open one of these up in a text editor you would see all sorts of noise such as the example below.<\/p>\n<div id=\"attachment_1760\" style=\"width: 544px\" class=\"wp-caption aligncenter\"><a href=\"https:\/\/i0.wp.com\/mingersoft.com\/blog\/wp-content\/uploads\/2011\/01\/Notepad-Binary-Code.png\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" aria-describedby=\"caption-attachment-1760\" class=\"size-full wp-image-1760\" title=\"Notepad Binary Code\" src=\"https:\/\/i0.wp.com\/mingersoft.com\/blog\/wp-content\/uploads\/2011\/01\/Notepad-Binary-Code.png?resize=544%2C453\" alt=\"Notepad Binary Code\" width=\"544\" height=\"453\" srcset=\"https:\/\/i0.wp.com\/mingersoft.com\/blog\/wp-content\/uploads\/2011\/01\/Notepad-Binary-Code.png?w=544&amp;ssl=1 544w, https:\/\/i0.wp.com\/mingersoft.com\/blog\/wp-content\/uploads\/2011\/01\/Notepad-Binary-Code.png?resize=300%2C249&amp;ssl=1 300w\" sizes=\"auto, (max-width: 544px) 100vw, 544px\" \/><\/a><p id=\"caption-attachment-1760\" class=\"wp-caption-text\">Notepad Binary Code<\/p><\/div>\n<p>So what is the difference between ASCII and binary modes in FTP?<\/p>\n<p>Basically, ASCII mode is used for <del>non-executable<\/del> plain text files (so <del>documents, spreadsheets, pictures,<\/del> batch\/shell scripts, HTML files, JavaScript files, etc) as this mode handles the conversion of the various characters in the file based upon the operating system being used on the receiving client (particularly if it differs from the operating system of the sending computer). This is particularly important for hidden end of line characters and other control characters as they differ in usage across platforms.<\/p>\n<p>Conversely, binary mode eliminates this conversion and enacts a strict and exact byte for byte transfer between the two computers. This means the file will be structurally identical on both machines. This is important for files such as pictures, music and videos which must be exact copies in order to preserve the integrity of the data.<\/p>\n<p>Executable files should also be transferred in binary mode however this does not mean that the binary file can run on the recipient computer if it is running a different operating system (unless it was written in something Java or another higher level language that runs on top of platform specific language interpreters). It&#8217;s also important that ZIP files should be treated as binary files so as to not break the compression dictionary or digital signature on the file. If you use FTP as a means to backup your data in ZIP files to a remote server then this will be particularly important if you&#8217;re scripting the transfer from scratch &#8211; definitely something to verify when testing your scripts.<\/p>\n<p>It&#8217;s also worth noting that FTP client software tends to treat files as <del>ASCII<\/del> binary by default unless told otherwise (either by built in settings or by an explicit switch that is specific upon transmission).<\/p>\n<div id=\"attachment_1761\" style=\"width: 617px\" class=\"wp-caption aligncenter\"><a href=\"https:\/\/i0.wp.com\/mingersoft.com\/blog\/wp-content\/uploads\/2011\/01\/FileZilla-ASCII-Transfer-File-Types.png\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" aria-describedby=\"caption-attachment-1761\" class=\"size-full wp-image-1761\" title=\"FileZilla - ASCII Transfer File Types\" src=\"https:\/\/i0.wp.com\/mingersoft.com\/blog\/wp-content\/uploads\/2011\/01\/FileZilla-ASCII-Transfer-File-Types.png?resize=617%2C401\" alt=\"FileZilla - ASCII Transfer File Types\" width=\"617\" height=\"401\" srcset=\"https:\/\/i0.wp.com\/mingersoft.com\/blog\/wp-content\/uploads\/2011\/01\/FileZilla-ASCII-Transfer-File-Types.png?w=617&amp;ssl=1 617w, https:\/\/i0.wp.com\/mingersoft.com\/blog\/wp-content\/uploads\/2011\/01\/FileZilla-ASCII-Transfer-File-Types.png?resize=300%2C194&amp;ssl=1 300w\" sizes=\"auto, (max-width: 617px) 100vw, 617px\" \/><\/a><p id=\"caption-attachment-1761\" class=\"wp-caption-text\">FileZilla &#8211; ASCII Transfer File Types<\/p><\/div>\n<div id=\"attachment_1762\" style=\"width: 677px\" class=\"wp-caption aligncenter\"><a href=\"https:\/\/i0.wp.com\/mingersoft.com\/blog\/wp-content\/uploads\/2011\/01\/Windows-FTP-Command-Line.png\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" aria-describedby=\"caption-attachment-1762\" class=\"size-full wp-image-1762\" title=\"Windows FTP Command Line\" src=\"https:\/\/i0.wp.com\/mingersoft.com\/blog\/wp-content\/uploads\/2011\/01\/Windows-FTP-Command-Line.png?resize=677%2C342\" alt=\"Windows FTP Command Line\" width=\"677\" height=\"342\" srcset=\"https:\/\/i0.wp.com\/mingersoft.com\/blog\/wp-content\/uploads\/2011\/01\/Windows-FTP-Command-Line.png?w=677&amp;ssl=1 677w, https:\/\/i0.wp.com\/mingersoft.com\/blog\/wp-content\/uploads\/2011\/01\/Windows-FTP-Command-Line.png?resize=300%2C151&amp;ssl=1 300w\" sizes=\"auto, (max-width: 677px) 100vw, 677px\" \/><\/a><p id=\"caption-attachment-1762\" class=\"wp-caption-text\">Windows FTP Command Line<\/p><\/div>\n<p>So now you should know the difference between ASCII and binary FTP modes and how the selection of these modes can be\u00a0influenced\u00a0by the FTP client software.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Edit: Thanks to Brian Layman for picking up some horrible errors on my part on the below \ud83d\ude42 A slightly more technical article for today. For those of you who use FTP every now and then along with FTP client software such as FileZilla or the command line FTP utility that comes with Windows you &hellip; <\/p>\n<p><a class=\"more-link btn\" href=\"https:\/\/mingersoft.com\/blog\/2011\/01\/ftp-and-the-difference-between-ascii-and-binary-modes\/\">Continue reading<\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_feature_clip_id":0,"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_post_was_ever_published":false},"categories":[63,1010,419,152,151,305,18],"tags":[1192,1193,1194,1011,2356,157],"class_list":["post-1759","post","type-post","status-publish","format-standard","hentry","category-communications","category-ftp","category-java","category-microsoft-operating-systems-technology","category-operating-systems","category-programming-languages","category-technology","tag-ascii","tag-binary","tag-client","tag-filezilla","tag-ftp","tag-windows","item-wrap"],"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/mingersoft.com\/blog\/wp-json\/wp\/v2\/posts\/1759","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/mingersoft.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/mingersoft.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/mingersoft.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/mingersoft.com\/blog\/wp-json\/wp\/v2\/comments?post=1759"}],"version-history":[{"count":0,"href":"https:\/\/mingersoft.com\/blog\/wp-json\/wp\/v2\/posts\/1759\/revisions"}],"wp:attachment":[{"href":"https:\/\/mingersoft.com\/blog\/wp-json\/wp\/v2\/media?parent=1759"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/mingersoft.com\/blog\/wp-json\/wp\/v2\/categories?post=1759"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/mingersoft.com\/blog\/wp-json\/wp\/v2\/tags?post=1759"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}