[Libreoffice-commits] online.git: Branch 'distro/collabora/co-4-2' - wsd/LOOLWSD.cpp

Andras Timar (via logerrit) logerrit at kemper.freedesktop.org
Sun Jun 21 13:18:49 UTC 2020


 wsd/LOOLWSD.cpp |   16 ++++++++++++++--
 1 file changed, 14 insertions(+), 2 deletions(-)

New commits:
commit 2a81afbee7e3dd6787dddb0a505deaadef6b1ac4
Author:     Andras Timar <andras.timar at collabora.com>
AuthorDate: Sun Jun 21 10:49:23 2020 +0200
Commit:     Aron Budea <aron.budea at collabora.com>
CommitDate: Sun Jun 21 15:18:30 2020 +0200

    fall back to en_US.UTF-8 if C.UTF-8 does not exist
    
    It turned out that C.UTF-8 is not supported on RH7/CentOS7.
    We started to use C.UTF-8 because it was widely available and we
    could shave off locale data in Ubuntu based docker images and
    AppImage. With this patch we fall back en_US.UTF-8 if C.UTF-8 does
    not exist and add some logging.
    
    Change-Id: Idea0ae885dc8cdd9ef33279bd90eb882a656d75c
    Reviewed-on: https://gerrit.libreoffice.org/c/online/+/96791
    Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice at gmail.com>
    Reviewed-by: Aron Budea <aron.budea at collabora.com>

diff --git a/wsd/LOOLWSD.cpp b/wsd/LOOLWSD.cpp
index 5c77a8a12..9a701f262 100644
--- a/wsd/LOOLWSD.cpp
+++ b/wsd/LOOLWSD.cpp
@@ -3669,8 +3669,20 @@ int LOOLWSD::innerMain()
     initializeSSL();
 
     // Force a uniform UTF-8 locale for ourselves & our children.
-    ::setenv("LC_ALL", "C.UTF-8", 1);
-    setlocale(LC_ALL, "C.UTF-8");
+    char* locale = std::setlocale(LC_ALL, "C.UTF-8");
+    if (!locale)
+    {
+        // rhbz#1590680 - C.UTF-8 is unsupported on RH7
+        LOG_WRN("Could not set locale to C.UTF-8, will try en_US.UTF-8");
+        locale = std::setlocale(LC_ALL, "en_US.UTF-8");
+        if (!locale)
+            LOG_WRN("Could not set locale to en_US.UTF-8. Without UTF-8 support documents with non-ASCII file names cannot be opened.");
+    }
+    if (locale)
+    {
+        LOG_INF("Locale is set to " + std::string(locale));
+        ::setenv("LC_ALL", locale, 1);
+    }
 
 #if !MOBILEAPP
     // We use the same option set for both parent and child loolwsd,


More information about the Libreoffice-commits mailing list