【问题标题】:Spring Integration SFTP issue : Accented characters replacedSpring Integration SFTP问题:重音字符被替换
【发布时间】:2014-07-30 20:02:29
【问题描述】:

我正在使用 Spring Integration 从 FTP 服务器检索文件(使用 SFTP)。 我的问题是 FTP 服务器上的文件名包含重音字符('é'、'à' 等)。找到的文件没有问题,但是一旦传输完成,重音就会被其他字符替换,例如“?”。 我想知道... Spring Integration 中是否有我遗漏的配置?

顺便说一句,FTP服务器和应用服务器都在Linux Ubuntu下。

这是我的 Spring 集成配置:

    <beans:bean id="sftpSessionFactory"
        class="org.springframework.integration.sftp.session.DefaultSftpSessionFactory">
        <beans:property name="host" value="${sftp.host}" />
        <beans:property name="port" value="${sftp.port}" />
        <beans:property name="user" value="${sftp.user}" />
        <beans:property name="password" value="${sftp.password}" />
    </beans:bean>

    <sftp:inbound-channel-adapter id="sftpInboundAdapter"
        channel="sftpReceiveChannel" session-factory="sftpSessionFactory"
        local-directory="file:${files.path}/input"
        remote-directory="${sftp.remote.dir}" auto-create-local-directory="true"
        delete-remote-files="true" filename-regex=".*\.xlsx$">
        <poller fixed-rate="10000" max-messages-per-poll="1" />
    </sftp:inbound-channel-adapter>

【问题讨论】:

    标签: java encoding ftp sftp spring-integration


    【解决方案1】:

    嗯 - 我刚刚运行了一个测试(mac os x 客户端,Ubuntu 12.04 服务器)。

    我写了一个文件é.txt到服务器;显示 sshd 调试日志

    close "/home/foo/si.sftp.sample/\303\251.txt" bytes read 3 written 0
    

    我明白了

    $ ls ~/si.sftp.sample/ 
    é.txt
    

    然后我获取了文件(没有特殊配置),它可以正常到达;带口音。

    【讨论】:

    • 您是否使用 Spring Integration 运行了测试?因为当我使用 sftp linux 命令传输文件时,一切正常;文件名保持不变。仅当使用 Spring Integration 进行传输时才会出现此问题;让我觉得这个问题与 Spring 相关......
    • 是的,我使用了sftp sample app 并更改了this line 上的文件名;在服务器上打开 VERBOSE 日志记录;设置断点并检查两端的文件名。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2011-03-23
    • 1970-01-01
    • 2017-11-09
    • 1970-01-01
    • 2017-12-22
    • 2013-06-12
    • 1970-01-01
    相关资源
    最近更新 更多