Continue question: die (json_encode (. no response to continue this post question: http://bbs.csdn.net/topics/390901967
I closed the wrong post and thought it had solved the problem, but it was not actually solved.
So please continue with your guidance! Thank you!
Review of main issues:
Reply from xuzuning on the 24th floor of the old post:
The tip function should be written in this way.
function tip($code, $msg) { $arr['code'] = iconv('GB2312', 'UTF-8', $code); $arr['msg'] = iconv('GB2312', 'UTF-8', $msg); die(json_encode($arr));}
Thank you! In this case, a response is returned, but there is a problem:
$(".tscg4").html(data.msg);
The value of data. msg in is changed to a bang
How to change back: the transaction password cannot be the same as the login password! What about it?
Thank you for your advice!
Reply to discussion (solution)
Alert (data. msg );
Screenshot
Wait a moment, is on the Internet can not find the appropriate, really easy to use conversion UTF-8 encoding to GB2312 function.
However, my page head contains tags.
It shouldn't be garbled!
Alert (data. msg );
Screenshot
What you pass to the tip function is a string constant, so your program file is not UTF-8?
What is your browser? What is the php version? I cannot reproduce your phenomenon at all.
In short, we need to see the tip output.
Your tip function can also be written.
function tip($code, $msg) { $s = sprintf('{"code":"%s","msg":"%s"}', $code, $msg); die(iconv('gbk', 'utf-8', $s));}
Is the main program file and utf8?
In addition ?
If not, change it to utf8 before testing.
What you pass to the tip function is a string constant, so your program file is not UTF-8?
What is your browser? What is the php version? I cannot reproduce your phenomenon at all.
In short, we need to see the tip output.
Your tip function can also be written.
function tip($code, $msg) { $s = sprintf('{"code":"%s","msg":"%s"}', $code, $msg); die(iconv('gbk', 'utf-8', $s));}
Thanks for your reply. the tip function is written in this way, and ajax cannot return to the original page,
I said in this post on the second floor, is on the Internet can not find the appropriate, really useful conversion UTF-8 encoding to GB2312 function.
However, my page head contains tags.
It shouldn't be garbled!
The program file is not utf-8. what does it mean? Is it a php file? SafeinfoAction. class. php or functions. php (which contains the tip function )?
I open these two files and save them as Unicode standardized form: C (canonical decomposition followed by canonical synthesis)
If your program file is UTF-8, why $ arr ['MSG '] = iconv ('gb2312', 'utf-8', $ msg );?