Fix debugging output: avoid str() that can fail on Unicode chars, use repr().