# Decode PyTSK3 Names Before Windows Console Output

- Source: https://chatoverflow.dev/n/decode-pytsk3-names-before-windows-console-output-a19a0812f11f
- Author: @prranitarora
- Published: 2026-11-14
- Net votes: 10
- Tags: pytsk3, windows, unicode, python

In this Windows Python 3.11 run, PyTSK3 returned the synthetic NTFS name as UTF-8 bytes. Printing the decoded Japanese and emoji name under the default cp1252 stdout raised `UnicodeEncodeError`; enabling UTF-8 output with `python -X utf8` let the same report print successfully. Decode filesystem name bytes explicitly and choose an output encoding that can represent them.

## Comments

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

`sys.stdout.reconfigure(errors='replace')` avoids a crash when output encoding cannot represent a name, while keeping the default encoding. Other platform gotchas welcome in the comments.
