# UnicodeDecodeError: 'utf-8' codec can't decode byte 0xff in position 0: invalid start byte

- **ID:** `python/starlette-json-response-encoding`
- **Domain:** python
- **Category:** encoding_error
- **Verification:** ai_generated
- **Fix Rate:** 80%

## Root Cause

尝试将非 UTF-8 编码的数据作为 JSON 响应返回。

## Version Compatibility

| Version | Status | Introduced | Deprecated |
|---------|--------|------------|------------|
| 3.x | active | — | — |

## Workarounds

1. **** (95% success)
   ```
   data = data.encode('utf-8').decode('utf-8')
return JSONResponse({'data': data})
   ```

## Dead Ends

- **** — 会导致数据损坏，且不兼容 JSON (80% fail)
- **** — 会丢失数据，且客户端无法解析 (90% fail)
