You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: src/site/markdown/faq.md
+9-12Lines changed: 9 additions & 12 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -52,23 +52,25 @@ used that take `LogString` as arguments, the macro `LOG4CXX_STR()` can be used t
52
52
to the current `LogString` type.
53
53
54
54
The default external representation is controlled by the `LOG4CXX_CHARSET` cmake option.
55
-
FileAppenders support an `Encoding` property allowing character set encoding control per appender.
56
-
For example, you can use `UTF-8` or `UTF-16` when writing XML or JSON layouts.
55
+
This default is used to encode a multi-byte characters
56
+
unless an `Encoding` property is explicitly configured
57
+
for the log4cxx::FileAppender specialization use use.
58
+
Note you should use `UTF-8` or `UTF-16` encoding when writing XML or JSON layouts.
57
59
Log4cxx also implements character set encodings for `US-ASCII` (`ISO646-US` or `ANSI_X3.4-1968`)
58
60
and `ISO-8859-1` (`ISO-LATIN-1` or `CP1252`).
59
61
You are highly encouraged to stick to `UTF-8` for the best support from tools and operating systems.
60
62
61
63
The `locale` character set encoding provides support beyond the above internally implemented options.
62
64
It allows you to use any multi-byte encoding provided by the standard library.
63
-
See also [some SO post](https://stackoverflow.com/questions/571359/how-do-i-set-the-proper-initial-locale-for-a-c-program-on-windows)
64
-
on setting the default locale in C++.
65
+
If using the `locale` character set encoding or the log4cxx::ConsoleAppender
66
+
you will need to explicitly configure the system locale at startup.
65
67
66
68
```
67
-
std::setlocale( LC_ALL, "" ); /* Set locale for C functions */
68
-
std::locale::global(std::locale("")); /* set locale for C++ functions */
69
+
std::setlocale( LC_ALL, "" ); /* Set user-preferred locale for the ConsoleAppender */
70
+
std::locale::global(std::locale("")); /* Set user-preferred locale for FileAppenders */
69
71
```
70
72
71
-
According to the [libc documentation](https://www.gnu.org/software/libc/manual/html_node/Setting-the-Locale.html),
73
+
This is necessary because, according to the [libc documentation](https://www.gnu.org/software/libc/manual/html_node/Setting-the-Locale.html),
72
74
all programs start in the `C` locale by default, which is the [same as ANSI_X3.4-1968](https://stackoverflow.com/questions/48743106/whats-ansi-x3-4-1968-encoding)
73
75
and what's commonly known as the encoding `US-ASCII`. That encoding supports a very limited set of
74
76
characters only, so inputting Unicode with that encoding in effect to output characters can't work
0 commit comments