spring-projects / spring-integration

Spring Integration provides an extension of the Spring programming model to support the well-known Enterprise Integration Patterns (EIP)
http://projects.spring.io/spring-integration/
Apache License 2.0
1.54k stars 1.1k forks source link

Encoding cannot be set on file:outbound-channel-adapter [INT-1067] #5074

Closed spring-operator closed 14 years ago

spring-operator commented 14 years ago

Alexander Heusingfeld opened INT-1067 and commented

If you can't set the encoding (or use a platform independent encoding as default), you can't write platform independent software.


Affects: 1.0.3

spring-operator commented 14 years ago

Alexander Heusingfeld commented

I just cloned this issue which originally was ##4932 as this is also a major bug in Spring Integration 1.0.3! The code snippets seem to be the same as in Iwein's fix actually.

Could you please create a bugfix release for this as it is currently having an impact on our production system.

Thanks guys. Alex

spring-operator commented 14 years ago

Alexander Heusingfeld commented

Dave,

I really intended to issue this as a bug!

My problem is that there are xml files coming from a jms queue which still contain a xml header including the encoding. E.g. \<?xml version="1.0" encoding="ISO-8859-1"?> When they are written to the disk via or the environments default encoding is used as the namespace does not allow changing this via configuration. Therefore all messages are exported with the same encoding no matter of

Iwein already "fixed" this for 2.0.0.M3 by providing a namespace configuration option.

To actually solve my issue I already thought about writing a file-transformer which extracts and removes the xml-header from the payload and adds a message header instead. Do you know whether there is something like this already in SI2.0.0.M3?

Cheers Alex

spring-operator commented 14 years ago

Iwein Fuld commented

We need to backport the fix into 1.0.x branch. Good spot. Why is the "fixed" in quotes btw, is there something special/fishy about the fix that went into 2.0.0.M3?

spring-operator commented 14 years ago

Iwein Fuld commented

Changing type to bug, fix version to 1.0.4

spring-operator commented 14 years ago

Alexander Heusingfeld commented

Iwein, thanks for fixing this.

I used quotes for "fixed" as I think the approach is not the optimal way of solving this. IMHO we should provide a way to define the encoding per message. In case of XML files this could be done by parsing the header and extracting the encoding to a message header. I'd suggest this feature can be enabled via configuration - not (only) by file suffix.

Unfortunately I haven't got any clue yet, how to guess the encoding of files other than XML... :-/

Cheers Alex

spring-operator commented 14 years ago

Iwein Fuld commented

Just committed the backport of #4932.

Alexander, could you run a latest build of the 1.0.x branch and confirm the fix works for you (reopen if it doesn't)?

For the other features you mentioned:

spring-operator commented 14 years ago

Alexander Heusingfeld commented

The fix seems to work - just as it did in 2.0.0.M3!

As to your suggestion I created #5083 to express the need for handling the encoding of XML files. I left out the "general" approach for all files as I think this should not be discussed any further before there are no practical experiences with the solution for XML files - which do contain an encoding info.