ronnin
07-22-2007, 11:17 PM
I'm trying to post form data in AJAX way, in which some fields has value of non-English character.
here is the sample form:
<html>
<head>
<title>sample</title>
<!--charset GB2312 is a charset of Simplified Chinese characters-->
<meta http-equiv="Content-Type" content="text/html; charset=GB2312" />
<link href="ext-1.1-rc1/resources/css/ext-all.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="ext-1.1-rc1/adapter/ext/ext-base.js"></script>
<script type="text/javascript" src="ext-1.1-rc1/ext-all-debug.js"></script>
<script type="text/javascript" src="ext-1.1-rc1/source/locale/ext-lang-zh_CN.js" charset="UTF-8"></script>
<script type="text/javascript" language="JavaScript">
Ext.BLANK_IMAGE_URL = "../images/s.gif";
</script>
<script type="text/javascript" src="js/sample.js"></script>
</head>
<body>
<form id="form-sample" name="form-sample" method="post">
<!--field has the value of two Chinese characters.-->
<input type="text" id="fuzz-field" name="fuzz-field" value="中文"/>
</form>
</body>
</html>
and here is part of sample.js, helpless in serval way:
Ext.Ajax.request({
url: "save.jsp",
form: "form-sample",
method: "POST",
headers: {"Content-Type":"application/x-www-form-urlencoded;charset=GB2312"},
success: cmnActionSuccess,
failure: cmnActionFailure
});
// another headers of Request
headers: {"Content-Type":"text/html;charset=GB2312"},
// another headers of Request
headers: {"encoding":"GB2312"},
BTW, this issue might be much common for non-english users,
but I have searched the forum by several keywords, such as "ajax form", "ajax encoding" "ajax charset", "form encoding", "headers", "non-english",etc. there is no helpfull results for me.
here is the sample form:
<html>
<head>
<title>sample</title>
<!--charset GB2312 is a charset of Simplified Chinese characters-->
<meta http-equiv="Content-Type" content="text/html; charset=GB2312" />
<link href="ext-1.1-rc1/resources/css/ext-all.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="ext-1.1-rc1/adapter/ext/ext-base.js"></script>
<script type="text/javascript" src="ext-1.1-rc1/ext-all-debug.js"></script>
<script type="text/javascript" src="ext-1.1-rc1/source/locale/ext-lang-zh_CN.js" charset="UTF-8"></script>
<script type="text/javascript" language="JavaScript">
Ext.BLANK_IMAGE_URL = "../images/s.gif";
</script>
<script type="text/javascript" src="js/sample.js"></script>
</head>
<body>
<form id="form-sample" name="form-sample" method="post">
<!--field has the value of two Chinese characters.-->
<input type="text" id="fuzz-field" name="fuzz-field" value="中文"/>
</form>
</body>
</html>
and here is part of sample.js, helpless in serval way:
Ext.Ajax.request({
url: "save.jsp",
form: "form-sample",
method: "POST",
headers: {"Content-Type":"application/x-www-form-urlencoded;charset=GB2312"},
success: cmnActionSuccess,
failure: cmnActionFailure
});
// another headers of Request
headers: {"Content-Type":"text/html;charset=GB2312"},
// another headers of Request
headers: {"encoding":"GB2312"},
BTW, this issue might be much common for non-english users,
but I have searched the forum by several keywords, such as "ajax form", "ajax encoding" "ajax charset", "form encoding", "headers", "non-english",etc. there is no helpfull results for me.