简体   繁体   English

Spring 集成 Ftp 出站网关文件夹中的特殊字符名称

[英]Spring Integration Ftp Outbound Gateway special character names in folder

I am using Spring integration's Ftp Outbound Gateway to fetch files from remote ftp server.我正在使用 Spring 集成的 Ftp 出站网关从远程 ftp 服务器获取文件。 I am creating copies of file in local directory of my environment.我正在环境的本地目录中创建文件副本。 My problem is that I am not able to fetch folders with correct name if they contains special characters like é,ú,á,í,ü.我的问题是,如果文件夹包含特殊字符,如 é、ú、á、í、ü,我将无法获取正确名称的文件夹。 My system is configured correctly it does not work only with files retrieved trough this gateway.我的系统配置正确,它不仅适用于通过此网关检索到的文件。

Thank you for every answer.谢谢你的每一个答案。

My config looks following:我的配置如下所示:

FtpOutboundGateway gateway = new FtpOutboundGateway(
            delegatingSessionFactory(runtimeSessionFactoryLocator), 
            "mget", 
            "payload"
    );

    gateway.setOptions("-P -R"); 
    gateway.setFilter(new AcceptOnceFileListFilter<FTPFile>());
    gateway.setFileExistsMode(FileExistsMode.REPLACE_IF_MODIFIED);
    gateway.setAutoCreateLocalDirectory(true);
    gateway.setLocalDirectoryExpression(new SpelExpressionParser()
            .parseExpression("'" + this.ftpStoragePath + "'" + "+#remoteDirectory")
    );

I found that Spel can have some issues with those special chars, but did not found the solution to avoid that.我发现 Spel 可能对这些特殊字符有一些问题,但没有找到避免这种情况的解决方案。

EDIT: I figured out a solution.编辑:我想出了一个解决方案。 I missed the DefaultFtpsSessionFactory where I was able to.setControlEncoding("UTF-8");我错过了我能够的 DefaultFtpsSessionFactory.setControlEncoding("UTF-8");

I figured out a solution.我想出了一个解决办法。 I missed the DefaultFtpsSessionFactory where I was able to.setControlEncoding("UTF-8");我错过了我能够的 DefaultFtpsSessionFactory.setControlEncoding("UTF-8");

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

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