This is an automated email from the ASF dual-hosted git repository. apupier pushed a commit to branch main in repository https://gitbox.apache.org/repos/asf/camel.git
commit f3582247ec6d77301fff6e313a6caa2a98b8a0ff Author: smjain <[email protected]> AuthorDate: Tue Sep 29 13:21:30 2026 +0530 CAMEL-25126: camel-syslog - document that the charset must be ASCII-compatible Co-Authored-By: Claude Opus 5.5 <[email protected]> --- .../java/org/apache/camel/component/syslog/SyslogConverter.java | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/components/camel-syslog/src/main/java/org/apache/camel/component/syslog/SyslogConverter.java b/components/camel-syslog/src/main/java/org/apache/camel/component/syslog/SyslogConverter.java index d3585d7e7ec1..b22551e8b471 100644 --- a/components/camel-syslog/src/main/java/org/apache/camel/component/syslog/SyslogConverter.java +++ b/components/camel-syslog/src/main/java/org/apache/camel/component/syslog/SyslogConverter.java @@ -161,8 +161,9 @@ public final class SyslogConverter { * Parses a syslog message. * * @param bytes the message - * @param charset the charset of the text fields. A MSG that starts with the UTF-8 byte order mark is always - * decoded as UTF-8, without the byte order mark (MSG-UTF8 of RFC 5424). + * @param charset the charset of the text fields, which must be ASCII-compatible (such as UTF-8 or ISO-8859-1), as + * the fields are split on ASCII bytes before they are decoded. A MSG that starts with the UTF-8 + * byte order mark is always decoded as UTF-8, without the byte order mark (MSG-UTF8 of RFC 5424). * @return the parsed message */ public static SyslogMessage parseMessage(byte[] bytes, Charset charset) { @@ -293,7 +294,8 @@ public final class SyslogConverter { /** * The parse loops read one char per byte ({@code (char) (b & 0xff)}), so each char of a field is one of its bytes. - * Turns the chars back into those bytes, and decodes the bytes with the charset of the message. + * Turns the chars back into those bytes, and decodes the bytes with the charset of the message. The charset must be + * ASCII-compatible, as the fields were split on ASCII bytes (a charset such as UTF-16 is not supported). */ private static String decode(CharSequence bytesAsChars, Charset charset) { return new String(bytesAsChars.toString().getBytes(StandardCharsets.ISO_8859_1), charset);
