Fixed unicode username user creation error

The code tries to construct a byte string object to test the
length of the string field (The explicit construction of the
string object is neccessary as sometime v can be other types,
for example int). This will cause error if the string field
(v) is a unicode object.

Fixes bug #1166701

Change-Id: I73cee4da5c9f91ce135e7f81d88c979871f61767
Merge "Fixed unicode username user creation error"