More encoding and escaping shenanigans