Added test for encode_key_value, also fixed backslashes.