空格从HTML表单转换为“+” [英] Spaces converting to '+' from HTML form

查看:321
本文介绍了空格从HTML表单转换为“+”的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

所以我一直在玩HTML表单,而且我对你很有帮助,所以任何帮助都会有很长的路要走!但无论如何...这是我的电子邮件的表单编码。






因此,当我提交表单并填写了正确的区域时,它将在Outlook(2010如果有问题)中打开
,然后转换电子邮件的
正文中的空格到'+'(加号)...任何人都可以给我想法?
此HTML将在我们网络中的离线网站上使用,不会
上线。所有的电脑都在这个域上,并且可以在那里桌面上访问这个
的HTML链接。

解决方案

您应该设置<$ c $>的 enctype 属性

 < form enctype =text / plain < form>  ... 

更多详情 this KB


在这两种情况下,FORM数据都通过电子邮件发送以编码格式作为附件。例如,在前面的例子中,这是数据的外观:

  Subject = Test + Subject& Body =%09kfdskfdksfkds% 0D%0A%09 

这是因为FORM元素的默认ENCTYPE属性是application / x -www窗体-urlencoded。要以纯文本格式电子邮件数据,请明确指定ENCTYPE属性text / plain。例如:

 < FORM Action =mailto:xyzMETHOD =POSTENCTYPE =text / plain> ; 
mailto:protocol test:
< Br> Subject:
< INPUT name =Subjectvalue =Test Subject>
< Br>正文:&#xa0;
< TEXTAREA name =Body>
kfdskfdksfkds
< / TEXTAREA>
< BR>
< INPUT type =submitvalue =Submit>
< / FORM>

产生以下正文:

  Subject = Test Subject 
Body = kfdskfdksfkds



So I've been playing around with HTML forms and I am kind of new you all of this so any help would go a long way! But anyway... This is my form coding for emailing.

So when I submit that form with the correct areas filled, it then opens in Outlook (2010 If that matters) were it then converts the spaces in the body of the email into '+' (Plus symbols)... Can anyone give me ideas? This HTML will be used on an offline site within our network and will not go live. All computers are on the domain and will have access to this HTML link on there desktop.

解决方案

You should set the enctype attribute of the <form> tag to text.

<form enctype="text/plain" ...

More details in this KB

In both cases, the FORM data is e-mailed in as an Attachment, in an encoded format. For instance, in the preceding case, this is how the data looks:

Subject=Test+Subject&Body=%09kfdskfdksfkds%0D%0A%09

This is because the default ENCTYPE attribute for the FORM element is "application/x-www-form-urlencoded". To e-mail data in > plain-text format instead, explicitly specify an ENCTYPE attribute of "text/plain". For instance:

<FORM Action="mailto:xyz" METHOD="POST" ENCTYPE="text/plain">
    mailto: protocol test:
    <Br>Subject: 
    <INPUT name="Subject" value="Test Subject">
    <Br>Body:&#xa0;
    <TEXTAREA name="Body">
    kfdskfdksfkds
    </TEXTAREA>
    <BR>
    <INPUT type="submit" value="Submit"> 
</FORM>

produces the following Body:

Subject=Test Subject
Body=   kfdskfdksfkds

这篇关于空格从HTML表单转换为“+”的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆