简体   繁体   English

FTP二进制传输后的字符集

[英]Charset after FTP binary transfer

We have two machines (unix and windows) and we send a file vía FTP from first (unix [IBM1047]) to second (windows [UTF16]). 我们有两台机器(unix和Windows),我们从第一个(unix [IBM1047])向第二个(windows [UTF16])发送FTP文件。 If you use ASCII mode, some especial characters such as Ñ ó... are not display correctly. 如果使用ASCII模式,某些特殊字符(例如Ñó...)将无法正确显示。 So we changed to BINARY mode and after the transfer we set charset file to UTF16. 因此,我们更改为BINARY模式,并在传输后将字符集文件设置为UTF16。 But everything works fine except returns carriages which are not displayed (1 line un the file). 但是一切正常,除了返回不显示的回车(文件的1行)。

So what is we missing? 那么,我们缺少什么呢?

Binary mode means that there are no changes done to the file, which includes changes on the line endings. 二进制模式意味着对文件没有任何更改,包括行尾的更改。 UNIX and Windows have traditionally different line endings, ie \\n on UNIX vs. \\r\\n on Windows. UNIX和Windows在传统上具有不同的行尾,即UNIX上的\\ n与Windows上的\\ r \\ n。 If your application is not able to deal with UNIX-style line endings you have to convert all the line endings in the file. 如果您的应用程序无法处理UNIX样式的行尾,则必须转换文件中的所有行尾。 See also Windows command to convert Unix line endings? 另请参见Windows命令转换Unix行尾吗? .

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM