Mongodb can’t accept a unicode configuration

I followed the official Mongodb configuration guide as described here,

http://docs.mongodb.org/manual/tutorial/install-mongodb-on-windows/

  1. Optional. Create a specific directory for MongoDB log files:

    md C:\mongodb\log
    
  2. Optional. Create a configuration file for the logpath option for MongoDB in the Command Promptby issuing this command:

    echo logpath=C:\mongodb\log\mongo.log > C:\mongodb\mongod.cfg

However, the mongod kept failing from a Powershell environment.

error command line: unrecognized line in ‘ ■l’
use –help for help

When the Powershell created a mongod.cfg file by using echo command, it basically filled the content as unicode by default so that mongod.exe coudn’t read it. Here is another SO thread talking the same problem: http://stackoverflow.com/questions/16930382/unrecognized-character-when-creating-mongodb-service

Solution: Save the .cfg file to use ANSI encoding, not UTF8 or UTF16.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s