[英]How set the charset of dynamic form to UTF-8?
I have a form created dynamically with one input: 我有一个输入动态创建的表单:
var myForm = document.createElement('form');
myForm.setAttribute('id', 'formDynamically');
myForm.method = 'POST';
myForm.action = 'myAction';
var myInput = document.createElement('input');
myInput.type = 'text';
myInput.name = 'textDescription';
myInput.value = $('#myTextField').text();
myForm.appendChild(myInput);
document.body.appendChild(myForm);
myForm.submit();
My problem is: 我的问题是:
If the user types a text with accentuation, in the server the letters arrive strange 如果用户输入带有重音符号的文本,则服务器中的字母会变得奇怪
Exemple: 'fiancé'. 例如:“未婚夫”。 in the server side i recived ---> 'fiancé' 在服务器端,我收到--->'fiancé'
obs: I can't change anything in server side. obs:我无法在服务器端进行任何更改。
obs²: I tried it with Jquery Ajax and works fine, the problem really is with my form (i can't use ajax, i must do it with form submit). obs²:我使用Jquery Ajax尝试了一下,并且工作正常,问题确实出在我的表单上(我不能使用ajax,我必须使用表单提交来完成)。
Any help is welcome ! 欢迎任何帮助!
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.