Uploaded image for project: 'Camel'
  1. Camel
  2. CAMEL-8191

Charset is ignored for SFTP producer endpoints

Attach filesAttach ScreenshotVotersWatch issueWatchersCreate sub-taskLinkCloneUpdate Comment AuthorReplace String in CommentUpdate Comment VisibilityDelete Comments
    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • 2.12.3, 2.14.1
    • 2.14.2, 2.15.0
    • camel-ftp
    • Unknown

    Description

      For SFTP producer endpoints option "charset" is ignored and the output file is created using platform-default charset (usually UTF-8).

      The simple Spring context illustrates the issue:

      <beans xmlns="http://www.springframework.org/schema/beans"
             xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
             xsi:schemaLocation="
             http://www.springframework.org/schema/beans 
             http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
             http://camel.apache.org/schema/spring 
             http://camel.apache.org/schema/spring/camel-spring.xsd">
        <camelContext xmlns="http://camel.apache.org/schema/spring">
          <route>
            <from uri="stream:in?promptMessage=Enter something:" />
            <to uri="sftp://localhost:22/vso/sandbox?charset=ISO-8859-1&amp;username=fake_sftp_user&amp;password=qwerty"/>
          </route>
        </camelContext>
      </beans>
      

      This context defines a route that transfers the string entered by user via SFTP. If the user enters "Müller", I can see 7-byte message in the output directory (because "ü" is represented using 2 bytes in UTF-8). While it should be 6-byte message if the file was encoded in ISO-8859-1.

      This problem affects only SFTP endpoints. File and FTP endpoints treat the "charset" option correctly.

      Attachments

        Activity

          This comment will be Viewable by All Users Viewable by All Users
          Cancel

          People

            davsclaus Claus Ibsen
            wheleph Volodymyr Sobotovych
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Slack

                Issue deployment