Skip to content
Merged
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
14 changes: 14 additions & 0 deletions src/vs/base/test/common/buffer.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,20 @@ suite('Buffer', () => {
assert.deepStrictEqual(buffer.toString(), 'hi');
});

test('issue #251527 - VSBuffer#toString preserves BOM character in filenames', () => {
// BOM character (U+FEFF) is a zero-width character that was being stripped
// when deserializing messages in the IPC layer. This test verifies that
// the BOM character is preserved when using VSBuffer.toString().
const bomChar = '\uFEFF';
const filename = `${bomChar}c.txt`;
const buffer = VSBuffer.fromString(filename);
const result = buffer.toString();

// Verify the BOM character is preserved
assert.strictEqual(result, filename);
assert.strictEqual(result.charCodeAt(0), 0xFEFF);
});

test('bufferToReadable / readableToBuffer', () => {
const content = 'Hello World';
const readable = bufferToReadable(VSBuffer.fromString(content));
Expand Down
Loading