Correctly decode current url parts when finding offsets for replacement