url compatible encoding and decoding