courseware/views.py index function unicode error correction and test

@adampalay @sarina 

https://edx-wiki.atlassian.net/browse/LMS-2488

The unicode input now correctly results in a 404 error instead of a 500 error.
General style: we prefer to use `.format()` instead of `%` replacements. However, this statement might actually be better as

`'/'.join(['/courses', self.course.id.to_deprecated_string(), ..., 'f'])`

probably splitting on the list length into separate lines rather than having one long line.