你可以做一个textarea不会自动编辑你的文本? [英] Can you make a textarea which doesn't automatically edit your text?

查看:81
本文介绍了你可以做一个textarea不会自动编辑你的文本?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在编写一个脚本,用于从文件中获取文本,并在最后添加/编辑校验和(使用文本编辑器,如记事本++,以便从硬盘上/从硬盘驱动器)。



浏览器textarea将 \\\
\r\\\
转换为 \ n 复制/粘贴时,然后转换为 \\\
\\ \\ r \ n 当转到另一个程序时(取决于您所在的操作系统)。这会使校验和不正确(即使您忽略校验和本身中任何不可打印字符的变形)。



我想我可以绕过这个打开/保存文件对话框(只要这里没有任何类似的意外),但也有其他项目,这也是有用的。

解决方案

看起来像这可能是不可能的,所以我发布了另一个问题,使用不同的方法从JavaScript获取数据到文件而不被损坏。请参阅在保存文件时保留javascript blob编辑数据


I'm writing a script that takes text from a file and adds/edits a checksum at the end (using a text editor like notepad++ to go to/from hard drive).

The browser textarea translates both \n and \r\n to \n when you copy/paste into it, and then converts to either \n or \r\n when going to another program (depending on which operating system you are in). This makes the checksum incorrect (even if you ignore the mangling of any non-printable characters in the checksum itself).

I guess I might be able to bypass this with the open/save file dialog (as long as there are not any similar surprises here), but there are other projects this would also be useful for.

解决方案

It looks like this may be impossible, so I am posting another question on using a different approach to getting data from javascript to a file without it being corrupted. See "Keep javascript blob from editing data when saving file"

这篇关于你可以做一个textarea不会自动编辑你的文本?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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