fix encoding and escape issue