New GitHub issue #110913 from sorgloomer:<br>

<hr>

<pre>
# Bug report

### Bug description:

Hi! The following code reliably produces some unicode [replacement characters �](https://www.compart.com/en/unicode/U+FFFD), on Windows, always in the same location. Works fine on Linux.

This report is a follow-up to this other one: https://github.com/python/cpython/issues/82052

[A fix was already attempted](https://github.com/python/cpython/pull/101103/files#diff-463599eb2f67c89107a6fc2431d387fef7fdbb8c860b2c424477ca9b9794282cR999), but as you can see, there are still some cases uncovered.

### Example 1
```sh
python -c "import sys;[sys.stdout.buffer.raw.write(b) for b in [b'\xc3', b'\xa9',b'\xc3\xa9']]"
```
![image](https://github.com/python/cpython/assets/5985835/8788d57c-9c49-41f9-9020-c4075c2dd551)

### Example 2
```python
print('é'*20001)
```
![image](https://github.com/python/cpython/assets/5985835/b1059ca2-0dee-48d4-9cbd-669b54967fcb)



### CPython versions tested on:

3.10, 3.12

### Operating systems tested on:

Linux, Windows
</pre>

<hr>

<a href="https://github.com/python/cpython/issues/110913">View on GitHub</a>
<p>Labels: type-bug</p>
<p>Assignee: </p>