Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Transfer UTF-8 file over FTP using ASCII mode?

The question says it all. Is it possible to transfer a UTF-8 file over FTP using ASCII mode? Or will this cause the characters to be written incorrectly? Thanks!

like image 568
bheltzel Avatar asked Dec 15 '25 02:12

bheltzel


1 Answers

  1. UTF-8 encoding was designed to be backward compatible with ASCII encoding.

  2. The RFC 959 requires the FTP clients and servers to treat the file in ASCII mode as 8-bit:

    3.1.1.1. ASCII TYPE

    ...

    The sender converts the data from an internal character representation to the standard 8-bit NVT-ASCII representation (see the Telnet specification). The receiver will convert the data from the standard form to his own internal form.

    In accordance with the NVT standard, the sequence should be used where necessary to denote the end of a line of text. (See the discussion of file structure at the end of the Section on Data Representation and Storage.)

    ...

    Using the standard NVT-ASCII representation means that data must be interpreted as 8-bit bytes.


So even UTF-8 unaware FTP client or server should correctly translate line-endings, as these are encoded identically in ASCII and UTF-8. And they should not corrupt the other characters.


From a practical point of view: I haven't met a server that does have problems with 8-bit text files. I'm Czech, so I regularly work with UTF-8 and in past with Windows-1250 and ISO/IEC 8859-2 8-bit encodings.

like image 99
Martin Prikryl Avatar answered Dec 16 '25 16:12

Martin Prikryl



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!