Prevent double encoding problems when URI fragment contains special characters (#10769)

Change-Id: I9043a1f84140b441ab4b3e86eadb708359a29155