Ensure entity value is type str

There are times when the entity value passed in for substitution
is of type unicode. This causes Rsvg to fail when processing the
SVG. This patch checks for unicode and converts it to utf-8.

Fixes #4621