Ensure that identity request variables are UTF-8 encoded (rebased onto dev_5_0) (rebased onto dev_4_4)


This is the same as gh-3047 but rebased onto dev_4_4.

----


This is the same as gh-2994 but rebased onto dev_5_0.

----

It is critical that the server recieves UTF-8 encoded strings and not
`unicode` instances.  Passing such instances blindly to the `str()`
constructor will result in a `UnicodeDecodeError` being raised.

To test (before):

* Have a user with extended (non Latin-1 characters in username and/or password)
* Using the `BlitzGateway` attempt to login; will fail silently
* If logging at `DEBUG` should log a `UnicodeDecodeError`

To test (after):

* Have a user with extended (non Latin-1 characters in username and/or password)
* Using the `BlitzGateway` attempt to login; should succeed