refactored encodeUri filter