Fix UnicodeError with anonymous student IDs

**Background**: Course IDs are allowed to contain unicode characters, but `anonymous_id_for_user(user, course_id)` currently throws a `UnicodeError` exception if it is given a course ID with non-ASCII characters. This pull request fixes the issue and adds a new test covering this case.

**Discussion**: Myself, @antoviaque, @mattdrayer have discussed this after we became aware of this due to test failures caused by this issue on the solutions fork.

**Affects**: `common` code, known to cause test failures in LMS under certain conditions, and likely would cause real-world errors in the LMS as well, for any courses with unicode characters in their course ID.

**How to reproduce**: Run the included test case without the fix to `models.py`

**Urgency**: Low-Moderate - Unknown if it is affecting any real installations.

**Authorship**: This is a contribution from OpenCraft.

Related comment: At some point in the future, I assume, we will want to get rid of `to_deprecated_string`, in which case this line will become `hasher.update(unicode(course_id).encode('utf-8'))`. That change could even be made now, but it changes how anonymous IDs are calculated, resulting in new hash values that won't match any previously generated hash values / anonymous IDs. Although previously generated anonymous IDs always get stored in a database and such a change is thus totally backwards compatible, there are a couple of unit tests and a runtime warning that are explicitly designed to catch such changes in how the digest is calculated. So for now I've stuck with the most clearly backwards-compatible route.
I think we tend to do `# -*- coding: utf-8 -*-` not that it makes a huge difference