[gnome-control-center] user-accounts: Try non TRANSLIT conversion if TRANSLIT conversion fails
- From: Georges Basile Stavracas Neto <gbsneto src gnome org>
 
- To: commits-list gnome org
 
- Cc: 
 
- Subject: [gnome-control-center] user-accounts: Try non TRANSLIT conversion if TRANSLIT conversion fails
 
- Date: Tue, 15 Feb 2022 14:15:11 +0000 (UTC)
 
commit fcbe0c039b279c020e69c637c4deaec71b99e94e
Author: Pablo Correa Gómez <ablocorrea hotmail com>
Date:   Mon Feb 14 20:29:04 2022 +0100
    user-accounts: Try non TRANSLIT conversion if TRANSLIT conversion fails
    
    This fixes a crash in musl-based systems, where TRANSLIT is not
    implemented. I followed musl-maintainer recommendation[1] of doing
    a run-time check to verify the behavior under these circumstances.
    
    [1] https://github.com/akrennmair/newsbeuter/issues/364#issuecomment-250208235
 panels/user-accounts/cc-add-user-dialog.c | 6 ++++++
 1 file changed, 6 insertions(+)
---
diff --git a/panels/user-accounts/cc-add-user-dialog.c b/panels/user-accounts/cc-add-user-dialog.c
index bb8835f41..e462015a4 100644
--- a/panels/user-accounts/cc-add-user-dialog.c
+++ b/panels/user-accounts/cc-add-user-dialog.c
@@ -444,6 +444,12 @@ generate_username_choices (const gchar  *name,
 
         ascii_name = g_convert_with_fallback (name, -1, "ASCII//TRANSLIT", "UTF-8",
                                               unicode_fallback, NULL, NULL, NULL);
+        /* Re-try without TRANSLIT. musl does not implement it */
+        if (ascii_name == NULL)
+                ascii_name = g_convert_with_fallback (name, -1, "ASCII", "UTF-8",
+                                                      unicode_fallback, NULL, NULL, NULL);
+        if (ascii_name == NULL)
+                return;
 
         lc_name = g_ascii_strdown (ascii_name, -1);
 
[
Date Prev][
Date Next]   [
Thread Prev][
Thread Next]   
[
Thread Index]
[
Date Index]
[
Author Index]