Print character encoding in `svn --version --verbose`.

- Add `locale encoding:` line to under machine information.

- Use apr_os_locale_encoding() to retrieve the name of the encoding. The
  same function is used to determine the encoding during xlate work, when
  converting from APR_LOCALE_CHARSET.

- The character encoding is being retrieved through the svn_version_extended_t
  structure.

Expected behaviors:

---

* running on x86_64-microsoft-windows6.2.9200
  - Windows 10 Pro, build 26100 [6.3 Client Multiprocessor Free]
  - character encoding: CP1252

---

* running on x86_64-unknown-linux-gnu
  - "Debian GNU/Linux 12 (bookworm)" [Linux 6.6.87.1-microsoft-standard-WSL2]
  - character encoding: UTF-8

---

* running on x86_64-unknown-linux-gnu
  - "Debian GNU/Linux 12 (bookworm)" [Linux 6.6.87.1-microsoft-standard-WSL2]
  - character encoding: ISO-8859-15

---

* subversion/include/svn_version.h
  (svn_version_ext_character_encoding): New function; Accesses character encoding.
* subversion/libsvn_subr/opt_subcommand.c
  (svn_opt__print_version_info): Add `character encoding` section and use
   the svn_version_ext_character_encoding() function to retrieve the name of
   the encoding.
* subversion/libsvn_subr/sysinfo.h
  (svn_sysinfo__character_encoding): Declare function; Detects the encoding.
* subversion/libsvn_subr/sysinfo.c
  (includes): Add apr_portable.h for apr_os_locale_encoding() function.
  (svn_sysinfo__character_encoding): Implement function; For now just a
   wrapper around apr_os_locale_encoding().
* subversion/libsvn_subr/version.c
  (svn_version_extended_t): Add character_encoding field and format code.
  (svn_version_extended): Initialize svn_version_extended_t::character_encoding
   using svn_sysinfo__character_encoding().
  (svn_version_ext_character_encoding): Implement accessor to character_encoding.

See related discussion on dev@s.a.o:
- https://lists.apache.org/thread/qyxgtkfmybwozz4ny8zxvc5hz16km8y7

Reviewed by: brane

git-svn-id: https://svn.apache.org/repos/asf/subversion/trunk@1926252 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/subversion/include/svn_version.h b/subversion/include/svn_version.h
index 0752448..392d26b 100644
--- a/subversion/include/svn_version.h
+++ b/subversion/include/svn_version.h
@@ -391,6 +391,16 @@
 svn_version_ext_runtime_osname(const svn_version_extended_t *ext_info);
 
 /**
+ * Accessor for svn_version_extended_t.
+ *
+ * @return The name of the current locale character set.
+ *
+ * @since New in 1.15.
+ */
+const char *
+svn_version_ext_character_encoding(const svn_version_extended_t *ext_info);
+
+/**
  * Dependent library information.
  * Describes the name and versions of known dependencies
  * used by libsvn_subr.
diff --git a/subversion/libsvn_subr/opt_subcommand.c b/subversion/libsvn_subr/opt_subcommand.c
index 97dd8e3..84dc7f8 100644
--- a/subversion/libsvn_subr/opt_subcommand.c
+++ b/subversion/libsvn_subr/opt_subcommand.c
@@ -491,6 +491,9 @@
                                      svn_version_ext_runtime_osname(info)));
         }
 
+      SVN_ERR(svn_cmdline_printf(pool, _("  - character encoding: %s\n"),
+                                 svn_version_ext_character_encoding(info)));
+
       libs = svn_version_ext_linked_libs(info);
       if (libs && libs->nelts)
         {
diff --git a/subversion/libsvn_subr/sysinfo.c b/subversion/libsvn_subr/sysinfo.c
index 65d099e..c8a63e4 100644
--- a/subversion/libsvn_subr/sysinfo.c
+++ b/subversion/libsvn_subr/sysinfo.c
@@ -35,6 +35,7 @@
 #include <apr_thread_proc.h>
 #include <apr_version.h>
 #include <apu_version.h>
+#include <apr_portable.h>       /* for apr_os_locale_encoding() */
 
 #include "svn_pools.h"
 #include "svn_ctype.h"
@@ -137,6 +138,12 @@
 #endif
 }
 
+const char *
+svn_sysinfo__character_encoding(apr_pool_t *pool)
+{
+  return apr_os_locale_encoding(pool);
+}
+
 const apr_array_header_t *
 svn_sysinfo__linked_libs(apr_pool_t *pool)
 {
diff --git a/subversion/libsvn_subr/sysinfo.h b/subversion/libsvn_subr/sysinfo.h
index 5493e4b..dc71788 100644
--- a/subversion/libsvn_subr/sysinfo.h
+++ b/subversion/libsvn_subr/sysinfo.h
@@ -45,6 +45,12 @@
  */
 const char *svn_sysinfo__release_name(apr_pool_t *pool);
 
+/* Return the name of the current locale character set.
+ *
+ * All allocations are done in POOL.
+ */
+const char *svn_sysinfo__character_encoding(apr_pool_t *pool);
+
 /* Return an array of svn_version_linked_lib_t of descriptions of the
  * link-time and run-time versions of dependent libraries, or NULL of
  * the info is not available.
diff --git a/subversion/libsvn_subr/version.c b/subversion/libsvn_subr/version.c
index 1375d64..0e9ffff 100644
--- a/subversion/libsvn_subr/version.c
+++ b/subversion/libsvn_subr/version.c
@@ -116,12 +116,13 @@
 
 struct svn_version_extended_t
 {
-  const char *build_date;       /* Compilation date */
-  const char *build_time;       /* Compilation time */
-  const char *build_host;       /* Build canonical host name */
-  const char *copyright;        /* Copyright notice (localized) */
-  const char *runtime_host;     /* Runtime canonical host name */
-  const char *runtime_osname;   /* Running OS release name */
+  const char *build_date;           /* Compilation date */
+  const char *build_time;           /* Compilation time */
+  const char *build_host;           /* Build canonical host name */
+  const char *copyright;            /* Copyright notice (localized) */
+  const char *runtime_host;         /* Runtime canonical host name */
+  const char *runtime_osname;       /* Running OS release name */
+  const char *character_encoding;   /* Encoding of the current locale */
 
   /* Array of svn_version_ext_linked_lib_t describing dependent
      libraries. */
@@ -153,6 +154,7 @@
     {
       info->runtime_host = svn_sysinfo__canonical_host(pool);
       info->runtime_osname = svn_sysinfo__release_name(pool);
+      info->character_encoding = svn_sysinfo__character_encoding(pool);
       info->linked_libs = svn_sysinfo__linked_libs(pool);
       info->loaded_libs = svn_sysinfo__loaded_libs(pool);
     }
@@ -197,6 +199,12 @@
   return ext_info->runtime_osname;
 }
 
+const char *
+svn_version_ext_character_encoding(const svn_version_extended_t *ext_info)
+{
+  return ext_info->character_encoding;
+}
+
 const apr_array_header_t *
 svn_version_ext_linked_libs(const svn_version_extended_t *ext_info)
 {