你可以做一个textarea不会自动编辑你的文本? [英] Can you make a textarea which doesn't automatically edit your text?
问题描述
我正在编写一个脚本,用于从文件中获取文本,并在最后添加/编辑校验和(使用文本编辑器,如记事本++,以便从硬盘上/从硬盘驱动器)。
浏览器textarea将 \\\
和
\r\\\
转换为
\ n
复制/粘贴时,然后转换为 \\\
或
\\ \\ r \ n
当转到另一个程序时(取决于您所在的操作系统)。这会使校验和不正确(即使您忽略校验和本身中任何不可打印字符的变形)。
我想我可以绕过这个打开/保存文件对话框(只要这里没有任何类似的意外),但也有其他项目,这也是有用的。
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屋!