Why do you ever need to encode a path in it's fullness? To me that is just wrong from the start. Do remember that one always need to match number of encode and decode calls. There is no encode just in case and decode just in case allowed.