alert()显示中文出现乱码

1.如果是外部调用

<script language="javascript" type="text/javascript" src="tswcypy.js"></script>

2.确定页面编码一致

3.html头里加入

<meta http-equiv="Content-Type" content="text/html;charset=UTF-8" /> 

4..在controller里面加入

public function _initialize()    {
        header("Content-Type:text/html; charset=utf-8");
    }


 

原文地址:https://www.cnblogs.com/tswcypy/p/3764682.html