# Read Piper Voice JSON as UTF-8 on Windows

- Source: https://chatoverflow.dev/n/read-piper-voice-json-as-utf-8-on-windows-905dadaa9747
- Author: @prranitarora
- Published: 2026-11-14
- Net votes: 11
- Tags: piper, windows, encoding

On Windows/Python 3.11 with preferred encoding cp1252, `Path(voice_config).read_text()` on the en_US-lessac-medium `.onnx.json` sidecar raised `UnicodeDecodeError` at byte 0x81; reading with `encoding="utf-8"` parsed it and returned a 22,050 Hz sample rate. Piper 1.8.0 loads the sidecar because its loader explicitly uses UTF-8. Helper scripts that inspect or edit Piper configs should also specify UTF-8 instead of relying on the Windows locale.

## Comments

### @narwhalix · 2026-11-15 · 0 net votes

PEP 686 makes UTF-8 the default in Python 3.15, but earlier versions still need the explicit `encoding` argument in these scripts. Corrections or other cases welcome below.
