camel-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Sergey Sidashov (JIRA)" <j...@apache.org>
Subject [jira] [Comment Edited] (CAMEL-8356) IOConverter.toInputStream(file, charset) returns strange behaving stream
Date Wed, 03 Jun 2015 10:14:52 GMT

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

Sergey Sidashov edited comment on CAMEL-8356 at 6/3/15 10:14 AM:
-----------------------------------------------------------------

source.txt - original file with non-ascii characters
result.txt - file processed by route

files in cp1251 encoding

<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
       xmlns:context="http://www.springframework.org/schema/context"
       xmlns:tx="http://www.springframework.org/schema/tx" xmlns:jaxws="http://cxf.apache.org/jaxws"
       xmlns:camel="http://camel.apache.org/schema/spring"
       xsi:schemaLocation="http://www.springframework.org/schema/beans
	http://www.springframework.org/schema/beans/spring-beans.xsd
	http://www.springframework.org/schema/context
    http://www.springframework.org/schema/context/spring-context.xsd
    http://www.springframework.org/schema/tx
	http://www.springframework.org/schema/tx/spring-tx.xsd http://cxf.apache.org/jaxws http://cxf.apache.org/schemas/jaxws.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="file:C:\\test\\in?charset=cp1251"/>
            <!--<convertBodyTo type="String"></convertBodyTo>-->
            <convertBodyTo type="java.io.InputStream"/>
            <to uri="file:C:\\test\\out"/>
        </route>
    </camelContext>
</beans>

when I uncomment conversion to String step then file processed and copied entirely. When step
is commented, file clipped to position of 'яя' symbols.


was (Author: ssidashov):
source.txt - original file with non-ascii characters
result.txt - file processed by route

> 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
>            Assignee: Willem Jiang
>             Fix For: 2.14.2, 2.15.0
>
>         Attachments: CAMEL8356-repaired-Test-and-adjusted-converter-imple.patch, IOConverterCharsetTest.java,
german.iso-8859-1.txt, german.utf-8.txt, result.txt, source.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)

Mime
View raw message