Encode strings to UTF-8 before sending them to LDAP.

According to the RFCs that I quickly browsed through, it looks like LDAP
expects text to be encoded as UTF-8. This typically doesn't matter because most
strings that we deal with for authentication are ASCII.

In bug 2978, a user had an accent in their password, which meant they couldn't
authenticate. This is easily fixed by encoding the strings first.

Testing done: Ran unit tests.

Fixes bug 2978.

Reviewed at https://reviews.reviewboard.org/r/5272/