Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# Generated references are compared byte-for-byte with the Rust renderer.
# Keep their checkout representation stable even with core.autocrlf=true.
skills/vibeshell/references/*.md text eol=lf
.claude/skills/vibeshell/references/*.md text eol=lf
.codex/skills/vibeshell/references/*.md text eol=lf
12 changes: 8 additions & 4 deletions src-tauri/src/ssh_import/putty.rs
Original file line number Diff line number Diff line change
Expand Up @@ -275,16 +275,20 @@ fn read_text_file(path: &Path) -> Result<String> {
let bytes = fs::read(path).with_context(|| format!("Failed to read {}", path.display()))?;
if bytes.starts_with(&[0xff, 0xfe]) {
let units: Vec<u16> = bytes[2..]
.chunks_exact(2)
.map(|chunk| u16::from_le_bytes([chunk[0], chunk[1]]))
.as_chunks::<2>()
.0
.iter()
.map(|chunk| u16::from_le_bytes(*chunk))
.collect();
return String::from_utf16(&units)
.with_context(|| format!("Invalid UTF-16 text in {}", path.display()));
}
if bytes.starts_with(&[0xfe, 0xff]) {
let units: Vec<u16> = bytes[2..]
.chunks_exact(2)
.map(|chunk| u16::from_be_bytes([chunk[0], chunk[1]]))
.as_chunks::<2>()
.0
.iter()
.map(|chunk| u16::from_be_bytes(*chunk))
.collect();
return String::from_utf16(&units)
.with_context(|| format!("Invalid UTF-16 text in {}", path.display()));
Expand Down
Loading