fixed a bug: when URL is contains UTF-8 string with extended bytes, trimming the string arbitrarily could result in a UTF-8 decoding error.