mirror of
https://github.com/tauri-apps/plugins-workspace.git
synced 2026-10-10 22:38:44 +02:00
fix(fs): only split UTF-16 lines on aligned line feeds (#3631)
In plugins/fs/src/commands.rs read_until_bytes / LinesBytes, the line feed sequence was matched at any byte offset, so UTF-16LE "ਗĀ" (17 0a 00 01) or UTF-16BE "Āਗ" (01 00 0a 17) split mid code unit and every following line was decoded misaligned. Line feed and carriage return sequences now only match on a multiple of their length from the start of the line. Unit tests with both examples (they fail without the fix).
This commit is contained in:
1 parent
dcc8cb032b
commit
5c144e7466
2 files changed
+44
-3
No files matched your search
@@ -0,0 +1,6 @@
|
||||
---
|
||||
fs: patch
|
||||
fs-js: patch
|
||||
---
|
||||
|
||||
Fixed `readTextFileLines` with a UTF-16 encoding splitting lines on a `0x0A 0x00` (LE) or `0x00 0x0A` (BE) byte sequence that is not aligned on a code unit, e.g. `ਗĀ`, which garbled every following line.
|
||||
Reference in new issue
Block a user