mirror of
https://github.com/QwenLM/qwen-code.git
synced 2025-12-20 16:57:46 +00:00
fix: prefer UTF-8 encoding for shell output on Windows when detected
This commit is contained in:
@@ -391,6 +391,19 @@ describe('Shell Command Processor - Encoding Functions', () => {
|
||||
expect(result).toBe('windows-1252');
|
||||
});
|
||||
|
||||
it('should prioritize UTF-8 detection over Windows system encoding', () => {
|
||||
mockedOsPlatform.mockReturnValue('win32');
|
||||
mockedExecSync.mockReturnValue('Active code page: 936'); // GBK
|
||||
|
||||
const buffer = Buffer.from('test');
|
||||
// Mock chardet to return UTF-8
|
||||
mockedChardetDetect.mockReturnValue('UTF-8');
|
||||
|
||||
const result = getCachedEncodingForBuffer(buffer);
|
||||
|
||||
expect(result).toBe('utf-8');
|
||||
});
|
||||
|
||||
it('should cache null system encoding result', () => {
|
||||
// Reset the cache specifically for this test
|
||||
resetEncodingCache();
|
||||
|
||||
Reference in New Issue
Block a user