为提升您的使用体验,本站正在维护,部分功能暂时无法使用。如果本站文章无法解决您的问题,您想要向社区提问的话,请到 Twitter 上的 @FirefoxSupport 或 Reddit 上的 /r/firefox 提问,我们的支持社区将会很快回复您的疑问。

搜索 | 用户支持

防范以用户支持为名的诈骗。我们绝对不会要求您拨打电话或发送短信,及提供任何个人信息。请使用“举报滥用”选项报告涉及违规的行为。

详细了解

Why FF uses "\n" line endings in tag textarea, but when data sent to server it uses "\r\n" line endings?

  • 2 个回答
  • 2 人有此问题
  • 9 次查看
  • 最后回复者为 the-edmeister

more options

I type a text into a textarea and by using a jQuery expression: `$('textarea:first').val().replace(/\r/g, 'R').replace(/\n/g, 'N')` it shows that FF uses "\n" endings and once the form is submitted the "\n" line endings are replaced with "\r\n" line endings

The problem is in incorrect text length for multi line text - on browser side it is less due "\n" line endings and on the server side it is longer due "\r\n" line endings and raises some text length validation inconsistency between browser and server sides.

I type a text into a textarea and by using a jQuery expression: `$('textarea:first').val().replace(/\r/g, 'R').replace(/\n/g, 'N')` it shows that FF uses "\n" endings and once the form is submitted the "\n" line endings are replaced with "\r\n" line endings The problem is in incorrect text length for multi line text - on browser side it is less due "\n" line endings and on the server side it is longer due "\r\n" line endings and raises some text length validation inconsistency between browser and server sides.

被采纳的解决方案

Hi vparamon, I do not want to say that this is a statement beyond the scope of this forum, because I know you can file a bug with troubleshooting information and steps to reproduce this with an example. However I also know it has to be reproducible. Is this unique to your server? If not please file a bug at http://bugzilla.mozilla.org with an example to make it easy to reproduce.

定位到答案原位置 👍 3

所有回复 (2)

more options

选择的解决方案

Hi vparamon, I do not want to say that this is a statement beyond the scope of this forum, because I know you can file a bug with troubleshooting information and steps to reproduce this with an example. However I also know it has to be reproducible. Is this unique to your server? If not please file a bug at http://bugzilla.mozilla.org with an example to make it easy to reproduce.

more options

Try posting at the Web Development / Standards Evangelism forum at MozillaZine. The helpers over there are more knowledgeable about web page development issues with Firefox.
http://forums.mozillazine.org/viewforum.php?f=25
You'll need to register and login to be able to post in that forum.