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?

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

报告相同问题?

悬赏问题

  • ¥15 c语言怎么用printf(“\b \b”)与getch()实现黑框里写入与删除?
  • ¥20 怎么用dlib库的算法识别小麦病虫害
  • ¥15 华为ensp模拟器中S5700交换机在配置过程中老是反复重启
  • ¥15 java写代码遇到问题,求帮助
  • ¥15 uniapp uview http 如何实现统一的请求异常信息提示?
  • ¥15 有了解d3和topogram.js库的吗?有偿请教
  • ¥100 任意维数的K均值聚类
  • ¥15 stamps做sbas-insar,时序沉降图怎么画
  • ¥15 买了个传感器,根据商家发的代码和步骤使用但是代码报错了不会改,有没有人可以看看
  • ¥15 关于#Java#的问题,如何解决?