Skip to content

CAMEL-18685: camel-file - add charsetUnmappable option to handle UnmappableCharacterException#24000

Closed
rpamu-jdev wants to merge 1 commit into
apache:mainfrom
rpamu-jdev:CAMEL-18685-charset-unmappable
Closed

CAMEL-18685: camel-file - add charsetUnmappable option to handle UnmappableCharacterException#24000
rpamu-jdev wants to merge 1 commit into
apache:mainfrom
rpamu-jdev:CAMEL-18685-charset-unmappable

Conversation

@rpamu-jdev

Copy link
Copy Markdown
Contributor

Summary

  • Adds a new charsetUnmappable endpoint option with values REPORT (default), IGNORE, and REPLACE
  • REPORT preserves existing behavior (throws UnmappableCharacterException)
  • IGNORE silently drops unmappable/malformed characters
  • REPLACE substitutes them with the charset replacement character

Changes

  • IOHelper - new toCodingErrorAction() helper and overloads for toReader/toInputStream/EncodingInputStream accepting CodingErrorAction
  • GenericFileEndpoint - new @UriParam option charsetUnmappable
  • GenericFile - carries charsetUnmappable alongside charset
  • FileConsumer - propagates setting when constructing GenericFile
  • GenericFileConverter - applies CodingErrorAction when reading
  • FileOperations - applies CodingErrorAction when writing

Usage

```java
from("file:inbox?charset=ISO-8859-1&charsetUnmappable=IGNORE")
from("file:inbox?charset=UTF-8").to("file:outbox?charset=ISO-8859-1&charsetUnmappable=REPLACE");
```

Fixes: https://issues.apache.org/jira/browse/CAMEL-18685

@github-actions

Copy link
Copy Markdown
Contributor

🌟 Thank you for your contribution to the Apache Camel project! 🌟
🤖 CI automation will test this PR automatically.

🐫 Apache Camel Committers, please review the following items:

  • First-time contributors require MANUAL approval for the GitHub Actions to run
  • You can use the command /component-test (camel-)component-name1 (camel-)component-name2.. to request a test from the test bot although they are normally detected and executed by CI.
  • You can label PRs using skip-tests and test-dependents to fine-tune the checks executed by this PR.
  • Build and test logs are available in the summary page. Only Apache Camel committers have access to the summary.

⚠️ Be careful when sharing logs. Review their contents before sharing them publicly.

@rpamu-jdev
rpamu-jdev marked this pull request as draft June 14, 2026 08:30
@rpamu-jdev rpamu-jdev closed this Jun 14, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants