added encoding try block to check for e.g. chinese letters in URLs