strip whitespace from the beginning and end of the display name

 strip whitespace from the beginning and end of the display name to avoid empty display names

If a display name stored in the database contains whitespaces only we return the uid. Before we set a new display name we check if it contains real characters, not only whitespaces.

cc @blizzz @PVince81 

fix #10817 
to make it more robust,  you check whether the returned value is a string. True (by hypothetical broken backend) would pass as well.