Skip to content

Make utf-8 the default character encoding#251

Merged
swebb2066 merged 3 commits intomasterfrom
change_default_charset
Aug 14, 2023
Merged

Make utf-8 the default character encoding#251
swebb2066 merged 3 commits intomasterfrom
change_default_charset

Conversation

@swebb2066
Copy link
Copy Markdown
Contributor

@swebb2066 swebb2066 commented Aug 12, 2023

The current default "locale" is not useful as it actually reverts to "US-ASCII" which writes a '?' for any non-ascii character.

@rm5248
Copy link
Copy Markdown
Contributor

rm5248 commented Aug 12, 2023

If you're getting ? characters, you may just need to set your locale(see FAQ: https://logging.apache.org/log4cxx/latest_stable/faq.html#unicode_supported)

I'm not sure if this changes that in any bad way.

@swebb2066
Copy link
Copy Markdown
Contributor Author

Unfortunately, the LocaleCharsetEncoder implementation has never worked. The names reported by apr_os_locale_encoding do not correspond to the names recognised by CharsetEncoder::getEncoder()

@swebb2066
Copy link
Copy Markdown
Contributor Author

swebb2066 commented Aug 14, 2023

With the LocaleCharsetEncoder now fixed, the change to UTF-8 as the default would only be justified if UTF-8 is a better default for log files, which I suspect is the case.

@rm5248 do you know what log file encoding aggregation services usually expect?

@swebb2066
Copy link
Copy Markdown
Contributor Author

swebb2066 commented Aug 14, 2023

While the encoder can be specified in the appender configuration, the examples in the documentation do not include that option.

Sending a JSONLayout or an XMLLayout to a file or socket in anything other than UTF-8 would not be good, and UTF-8 is an expected default for .txt files.

Hence I conclude that changing the default encoding to UTF-8 is important.

@swebb2066 swebb2066 merged commit 5bcd74b into master Aug 14, 2023
@swebb2066 swebb2066 deleted the change_default_charset branch August 14, 2023 05:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants