[ 
https://issues.apache.org/jira/browse/CAMEL-16016?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17308425#comment-17308425
 ] 

Pavel Kostelnik commented on CAMEL-16016:
-----------------------------------------

Hi [~davsclaus] - ok I get your point but the problem originates from us using 
this in an endpoint URI definition.

So:
 * when using password without RAW in endpoint URI camel complains about 
invalid characters
 * when we wrap password in RAW in our camel endpoint URI it is encoded to 
gibberish

I understand that  by giving this special parameter it is fixed but this would 
mean we have to manually check for passwords every time and think about this 
and encode and the password appropriately. If this (
UnsafeUriCharactersEncoder.encode(password, true);
) is the definitive solution to the problem is there a reason why it is not 
used by default for encoding all passwords?

> Encoding special characters via UnsafeUriCharactersEncoder does not work in 
> all cases
> -------------------------------------------------------------------------------------
>
>                 Key: CAMEL-16016
>                 URL: https://issues.apache.org/jira/browse/CAMEL-16016
>             Project: Camel
>          Issue Type: Bug
>          Components: camel-core
>    Affects Versions: 2.20.4, 3.8.0
>            Reporter: Pavel Kostelnik
>            Assignee: Claus Ibsen
>            Priority: Minor
>             Fix For: 3.8.0
>
>
> we have the following FTP password:
> {code:java}
> String password= "%j#7%c6i";{code}
> when encoded with camel (*we are using RAW()*) this results in a gibberish 
> string with <?> (unprintable characters)
> ==> expected output:
> %25j%237%25c6i
> Sample test demonstrating the bug / reproducer:
> {code:java}
> @Test
> public void testWrongEncoding(){
>    String password= "%j#7%c6i";
>    String result = UnsafeUriCharactersEncoder.encode(password);
>    String expected = "%25j%237%25c6i";
>    System.out.println("expected ->  "+expected);
>    System.out.println("vs");
>    System.out.println(result);
>    if (!result.equals(expected)){
>       System.err.println("not the same , no no ");
>    }
> }
> {code}
>  



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to