[master][PATCH] Fix handling of non-ASCII names (#969309)

David Shea dshea at redhat.com
Thu Jul 18 19:30:45 UTC 2013


When converting a full name into a username, decode the entire first
word of the name before the taking the first initial. Before the string
is decoded, the first byte may be the first byte of a UTF-8 encoded code
point instead of a complete character.
---
 pyanaconda/users.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/pyanaconda/users.py b/pyanaconda/users.py
index e5963fb..135f819 100644
--- a/pyanaconda/users.py
+++ b/pyanaconda/users.py
@@ -159,7 +159,7 @@ def guess_username(fullname):
 
     # and prefix it with the first name inital
     if len(fullname) > 1:
-        username = fullname[0][0].decode("utf-8").lower() + username
+        username = fullname[0].decode("utf-8")[0].lower() + username
 
     username = strip_accents(username).encode("utf-8")
     return username
-- 
1.8.3.1



More information about the anaconda-patches mailing list