Fix Unicode issues with course ID values

Card: [CMS error, when opening a new course that have an arabic org name.](https://trello.com/c/roKoXIeH/348-cms-error-when-opening-a-new-course-that-have-an-arabic-org-name)
This PR contains the essential parts of https://github.com/edx/edx-platform/pull/5827.

Just to confirm, the tests have passed in edX CI if we have added only this change:

![image](https://cloud.githubusercontent.com/assets/645156/4896803/5207e82e-63ff-11e4-9d59-0b6283d0db39.png)