Where does the bug appear (feature/product)?
Cursor IDE
Describe the Bug
On Windows, Cursor Hooks receive corrupted Korean UTF-8 text through stdin.
The corruption happens before my hook script sends anything to my backend. I verified this by
logging the raw stdin bytes, UTF-8-decoded stdin string, and parsed JSON inside the hook script.
Example Korean prompt entered in Cursor:
다시한번 백엔드 로그를 찾아보자. 안녕.
Expected hook payload:
{
“prompt”: “다시한번 백엔드 로그를 찾아보자. 안녕.”
}
Actual hook stdin payload already contains corrupted text:
?ㅼ떆?쒕쾲 諛깆뿏??濡쒓렇瑜?李띿뼱蹂댁옄. ?덈뀞.
The backend is not the cause. The hook script receives the corrupted value before JSON.parse() and before making any HTTP request.
Additional evidence: the transcript_path JSONL file contains the correct Korean text, but the hook
stdin payload contains corrupted Korean text.
Steps to Reproduce
- Configure a Cursor Hook for beforeSubmitPrompt.
- Use a hook script that reads raw stdin bytes and logs:
- stdin byte length
- stdin hex prefix
- Buffer.concat(chunks).toString(‘utf8’)
- parsed payload.prompt
- Submit a Korean prompt in Cursor:
다시한번 백엔드 로그를 찾아보자. 안녕.
- Check the hook script logs.
Minimal debug script:
const buffers = ;
process.stdin.on(‘data’, chunk => {
buffers.push(Buffer.isBuffer(chunk) ? chunk : Buffer.from(chunk));
});
process.stdin.on(‘end’, () => {
const fullBuffer = Buffer.concat(buffers);
console.log(‘stdin byteLength:’, fullBuffer.length);
console.log(‘stdin hex prefix:’, fullBuffer.subarray(0, 256).toString(‘hex’));
console.log(‘stdin utf8:’, fullBuffer.toString(‘utf8’));
const payload = JSON.parse(
fullBuffer.toString('utf8').trim().replace(/^\uFEFF/, '')
);
console.log('parsed prompt:', payload.prompt);
});
Observed log:
stdin utf8:
{“prompt”:“?ㅼ떆?쒕쾲 諛깆뿏??濡쒓렇瑜?李띿뼱蹂댁옄. ?덈뀞.”, …}
parsed prompt:
?ㅼ떆?쒕쾲 諛깆뿏??濡쒓렇瑜?李띿뼱蹂댁옄. ?덈뀞.
The raw hex also shows that the corrupted string is already encoded in stdin. For example, the
prompt value contains bytes like:
3f e3 85 bc …
This means the hook receives ?ㅼ… as UTF-8 text, not the original Korean UTF-8 bytes.
Operating System
Windows 10/11
Version Information
Version: 3.6.31
Does this stop you from using Cursor
No - Cursor works, but with this issue