错误: Windows 文件写入将 CRLF 转换为 CRCRLF
作者: 2gg-bit创建于 2026年9月29日更新于 2026年9月29日
On Windows, LocalFileOperator.write_file uses the default newline conversion, and when writing text that already contains CRLF, it becomes CRCRLF. Reproducible: await LocalFileOperator().write_file(path, "one\r\ntwo\r\n"), then check with Path(path).read_bytes(), which returns b"one\r\r\ntwo\r\r\n". This causes extra blank lines in files generated by the editor. The expected behavior is to preserve the newline characters passed by the caller, ensuring cross-platform consistency. Setting newline="" disables the output end newline conversion.
内容来源: FoundationAgents/OpenManus