Uploaded image for project: 'Core Server'
  1. Core Server
  2. SERVER-91108

Log with utf-8 encoding to avoid charmap errors on Windows

    • Correctness
    • Fully Compatible
    • v8.0, v7.0, v6.0, v5.0
    • 200

      File "C:\python\python310\lib\encodings\cp1252.py", line 19, in encode
          return codecs.charmap_encode(input,self.errors,encoding_table)[0]
      UnicodeEncodeError: 'charmap' codec can't encode characters in position 295-358: character maps to <undefined>
      

      This non-fatal error is confusing and has led to BFs (BF-33486) that incorrectly point to this as the source of failure. Even though benign, marking as P3 given the painpoints to the log-scanning layperson.

      I think this amounts to literally changing

      self.file = open(filename, "a")
      

      to

      self.file = open(filename, "a", encoding="utf-8")
      

      inside buildscripts/resmokelib/logging/handlers.py.

      This is in Resmoke utilities, which belong to my team of Correctness, but julian.edwards@mongodb.com, since you recently implemented this via SERVER-77561 (and we have very tight bandwidth), would you mind following up? This may also require backports.

            Assignee:
            steve.mcclure@mongodb.com Steve McClure
            Reporter:
            steve.mcclure@mongodb.com Steve McClure
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: