[SERVER-32427] Config file parser does not support UTF-16 encoded files marked with a BOM Created: 20/Dec/17  Updated: 30/Oct/23  Resolved: 08/Jan/18

Status: Closed
Project: Core Server
Component/s: None
Affects Version/s: None
Fix Version/s: 3.7.1

Type: Bug Priority: Major - P3
Reporter: Mark Benvenuto Assignee: Mark Benvenuto
Resolution: Fixed Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Related
related to DOCS-11079 Investigate issues with installing Mo... Closed
Backwards Compatibility: Fully Compatible
Operating System: ALL
Sprint: Platforms 2018-01-15
Participants:
Case:

 Description   

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.



 Comments   
Comment by Githook User [ 08/Jan/18 ]

Author:

{'name': 'Mark Benvenuto', 'username': 'markbenvenuto', 'email': 'mark.benvenuto@mongodb.com'}

Message: SERVER-32427 Config file parser does not support UTF-16 encoded files marked with a BOM
Branch: master
https://github.com/mongodb/mongo/commit/52c3dc23a9b8e532482d6be480a105a805b26faf

Generated at Thu Feb 08 04:30:12 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.