Glitchy question marks in the terminal window

I’ve noticed that sometimes in the mongo shell there will be text-glitches that show up as ugly little question marks, like in the below screen shot.

Obviously it’s an encoding error having something to do with the " character, but does anyone know how to fix the glitch?

The bug is in the shell, not my Terminal, I saw the same behavior in the most recent instructional video I watched.

Are you sure it’s not just a data problem?

#1
db.movies.find({year: /^\d{4}[^\d]/}, {year: 1, _id: 0}).pretty()

#2
db.movies.find({$and: [{year: {$type: "string"}}, {$expr: {$gte: [{$strLenCP: "$year"},6]}}]}, {year: 1, _id: 0}).pretty()

Well those queries and their results seem to prove that it’s something about the data and how terminal presents them. Maybe it’s a problem with the hyphen-minus? (U+002D) and how terminal presents that character, or how that character gets encoded/decoded into BSON format?


In the above I’m using a UTF-8 codepage (65001), BSON strings are also UTF-8 meaning that MongoDB can definitely handle it. So it’s not a de-serialisation or presentation problem. The actual data was inserted incorrectly, maybe in error or as intended.