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

Config file parser does not support UTF-16 encoded files marked with a BOM

    • Type: Icon: Bug Bug
    • Resolution: Fixed
    • Priority: Icon: Major - P3 Major - P3
    • 3.7.1
    • Affects Version/s: None
    • Component/s: None
    • None
    • Fully Compatible
    • ALL
    • Platforms 2018-01-15

      By following the install instructions at: https://docs.mongodb.com/manual/tutorial/install-mongodb-on-windows/#create-a-configuration-file, users may create files with marked with the BOM (Byte order mark), and encode the file in UTF-16. MongoDB throws an error instead of accepting file.

      Example config:

      systemLog:
          destination: file
          path: c:\data\log\mongod.log
      storage:
          dbPath: c:\data\db
      

      when saved as Unicode in Notepad on Windows it is stored as:

      > xxd example.txt
      0000000: fffe 7300 7900 7300 7400 6500 6d00 4c00  ..s.y.s.t.e.m.L.
      0000010: 6f00 6700 3a00 0d00 0a00 2000 2000 2000  o.g.:..... . . .
      0000020: 2000 6400 6500 7300 7400 6900 6e00 6100   .d.e.s.t.i.n.a.
      0000030: 7400 6900 6f00 6e00 3a00 2000 6600 6900  t.i.o.n.:. .f.i.
      0000040: 6c00 6500 0d00 0a00 2000 2000 2000 2000  l.e..... . . . .
      0000050: 7000 6100 7400 6800 3a00 2000 6300 3a00  p.a.t.h.:. .c.:.
      0000060: 5c00 6400 6100 7400 6100 5c00 6c00 6f00  \.d.a.t.a.\.l.o.
      0000070: 6700 5c00 6d00 6f00 6e00 6700 6f00 6400  g.\.m.o.n.g.o.d.
      0000080: 2e00 6c00 6f00 6700 0d00 0a00 7300 7400  ..l.o.g.....s.t.
      0000090: 6f00 7200 6100 6700 6500 3a00 0d00 0a00  o.r.a.g.e.:.....
      00000a0: 2000 2000 2000 2000 6400 6200 5000 6100   . . . .d.b.P.a.
      00000b0: 7400 6800 3a00 2000 6300 3a00 5c00 6400  t.h.:. .c.:.\.d.
      00000c0: 6100 7400 6100 5c00 6400 6200            a.t.a.\.d.b.
      

            Assignee:
            mark.benvenuto@mongodb.com Mark Benvenuto
            Reporter:
            mark.benvenuto@mongodb.com Mark Benvenuto
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: