[Libreoffice-commits] online.git: Branch 'libreoffice-7-0' - wsd/LOOLWSD.cpp

Andras Timar (via logerrit) logerrit at kemper.freedesktop.org
Wed Jun 24 13:01:38 UTC 2020


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

New commits:
commit 06291700f05d25b422e97ce4d8f1283c501bec9e
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: Wed Jun 24 15:01:19 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/+/96788
    Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice at gmail.com>
    Reviewed-by: Andras Timar <andras.timar at collabora.com>
    (cherry picked from commit 3a904c203152636c4f59dc62c792e64389c6abe7)
    Reviewed-on: https://gerrit.libreoffice.org/c/online/+/96793
    Tested-by: Aron Budea <aron.budea at collabora.com>
    Reviewed-by: Aron Budea <aron.budea at collabora.com>

diff --git a/wsd/LOOLWSD.cpp b/wsd/LOOLWSD.cpp
index e016bd01b..003fcf89b 100644
--- a/wsd/LOOLWSD.cpp
+++ b/wsd/LOOLWSD.cpp
@@ -3609,8 +3609,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