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

Stefan Mandel commented on CAMEL-8356:
--------------------------------------

How exactly is the specification of  IOconvert.toInputStream(File file, String 
charset)?

I expected that it transforms the file to a stream using the specified charset. 
In fact that method uses the charset (can be seen in the implementation), but 
the resulting stream delivers exactly the same byte sequence as the one without 
charset specification.

Using  IOconvert.toReader(File file, String charset) would be fine, but will 
not work for 2.14.x because it is not public in this branch. Besides this is a 
workaround, but the inconsistency of toInputStream stays.

> IOConverter.toInputStream(file, charset) returns strange behaving stream
> ------------------------------------------------------------------------
>
>                 Key: CAMEL-8356
>                 URL: https://issues.apache.org/jira/browse/CAMEL-8356
>             Project: Camel
>          Issue Type: Bug
>          Components: camel-core
>    Affects Versions: 2.14.1, 2.15.0
>            Reporter: Stefan Mandel
>         Attachments: IOConverterCharsetTest.java, german.iso-8859-1.txt, 
> german.utf-8.txt
>
>
> Calling IOConverter.toInputStream with either UTF-8 or ISO-8859-1 returns a 
> stream that behaves strange on non-ascii-characters:
> - putting this stream into an InputStreamReader will return false encoded 
> characters
> - a naive new BufferedReader(new InputStreamReader(new FileInputStream(file), 
> charset)) will return the correctly encoded characters.
> I will attach some unit tests for this case.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to