Avoid un-necessary decode in startsWith/endsWith

As requested in #2503.

Perhaps it's overkill?
Why would it be useful, though? I don't think we should enable potentially ambiguous behavior without a good reason, or we might regret it later.