doujianjian2060 2013-12-18 00:07
浏览 70
已采纳

如何使用ftp_put和utf-8字符

I am using a custom function that creates a text file with fopen() and then this text file is uploaded on a server using ftp_put in ASCII mode.

My problem is that once the file is uploaded and once I open it in my text editor, accents are automatically transformed into gibberish characters instead of staying the same.

I know there is no FTP transfer mode for UTF-8, so what php function should I use to keep the utf-8 characters properly formatted once I open the file that has been uploaded?

fopen(..., 'w+')
original string : é
ftp_put(...., FTP_ASCII)
once the file is uploaded, the string looks like: én

Thanks

  • 写回答

1条回答 默认 最新

  • doupingpeng7567 2013-12-18 00:13
    关注

    Don't use FTP_ASCII. This mode automatically converts the line endings from the platform standard of the FTP client into the platform standard of the FTP server. Always use binary mode - this will transfer all files unchanged.

    And then: How do you check the file was uploaded correctly, and how are you actually transferring the data?

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥20 机器学习能否像多层线性模型一样处理嵌套数据
  • ¥20 西门子S7-Graph,S7-300,梯形图
  • ¥50 用易语言http 访问不了网页
  • ¥50 safari浏览器fetch提交数据后数据丢失问题
  • ¥15 matlab不知道怎么改,求解答!!
  • ¥15 永磁直线电机的电流环pi调不出来
  • ¥15 用stata实现聚类的代码
  • ¥15 请问paddlehub能支持移动端开发吗?在Android studio上该如何部署?
  • ¥20 docker里部署springboot项目,访问不到扬声器
  • ¥15 netty整合springboot之后自动重连失效