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

New commits:
commit 3a904c203152636c4f59dc62c792e64389c6abe7
Author:     Andras Timar <andras.ti...@collabora.com>
AuthorDate: Sun Jun 21 10:49:23 2020 +0200
Commit:     Andras Timar <andras.ti...@collabora.com>
CommitDate: Sun Jun 21 16:25:50 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 <jenkinscollaboraoff...@gmail.com>
    Reviewed-by: Andras Timar <andras.ti...@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,
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to