Default character encoding seems to be ignored

Even though the default encoding for stdout seems to be set to utf-8, whenever I write something to stdout and redirect the output to a file, it’s saved as utf-16. I’m running Anaconda Navigator 2.4.3 and Python 3.10.12 under Windows 10 (64-bit).

Here’s a screen print of a simple example, writing one line of text to a file, ‘test.txt’. When I run another python program to detect the encoding, it tells me it’s utf-16.

Furthermoe, if I open the file in TextPad (the text editor I normally use for general text editing), it also tells me it’s utf-16.

What am I doing wrong? Is this a bug, or is there something I don’t understand about the default character encodings in Python?