Fixed UnicodeEncodeError in task link generation.

The current task link generation (see PR #631) does not handle non-ascii character
correctly in all case. Which ends up in an UnicodeEncodeError.

@deiferni please have a look