[New-bugs-announce] [issue43711] cgi.log() uses default encoding

Inada Naoki report at bugs.python.org
Sat Apr 3 07:14:45 EDT 2021


New submission from Inada Naoki <songofacandy at gmail.com>:

See cgi.initlog():
https://github.com/python/cpython/blob/b2a91e0c9ee18b50cc86b21211c2258520a9f5d0/Lib/cgi.py#L82

```
            logfp = open(logfile, "a")
```

This feature is not documented but can be used like this.

```
import cgi
cgi.logfile="myapp.log"
cgi.log("こんにちは")
```

I want to change log file encoding to UTF-8. Although this is backward incompatible change, it unlikely break user application because it just change the logfile encoding.

UTF-8 is safer than locale encoding because UTF-8 supports all valid Unicode strings.

----------
components: Library (Lib)
messages: 390120
nosy: methane
priority: normal
severity: normal
status: open
title: cgi.log() uses default encoding
versions: Python 3.10

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue43711>
_______________________________________


More information about the New-bugs-announce mailing list