Avoid un-necessary decode in startsWith/endsWith

As requested in #2503.

Perhaps it's overkill?
Why are we comparing characters? As far as I can tell there is no reason to do that. There should be no decoding, just check the first code unit.