什么是ANSI编码格式?它是系统默认格式吗?它与ASCII有什么不同?
我想知道是否可以使用 Javascript 和 ANSI 编码的 BLOB 保存一个简单的 txt 文件。
\n\n目前,我有一个脚本创建一个带有 CRLF 行结尾但采用 UTF-8 编码的 txt 文件。
\n\n可以用ANSI编码保存吗?我需要这个来导入需要 ANSI 而不是 UTF-8 的“旧”Windows 程序上的 txt 文件。
\n\n这是我使用的示例:\n https://jsfiddle.net/UselessCode/qm5AG/
\n\nlet textFile = null;\n\nfunction makeTextFile () {\n let text = `Some text with nice line endings\\nand special characters like \xc3\xa9 and \xc3\xbc.`;\n\n const data = new Blob([text], {\n type: "text/plain",\n endings: "native"\n });\n\n if (textFile !== null) {\n window.URL.revokeObjectURL(textFile);\n }\n\n textFile = window.URL.createObjectURL(data);\n\n return textFile;\n}\nRun Code Online (Sandbox Code Playgroud)\n