1

Does mongoimport cli command support only UTF-8 format files?

Is there a way to provide encoding format so that, it can accept non-utf-8 files, without we manually converting each file to UTF-8?

profesor79
  • 9,213
  • 3
  • 31
  • 52
Raja Nagendra Kumar
  • 792
  • 1
  • 6
  • 19

1 Answers1

4

This is one way of doing it on Linux/Unix. You could use iconv to convert non-utf8 to utf8 and then use mongoimport on the converted file:

iconv -f ISO-8859-1 -t utf-8 myfile.csv > myfileutf8.csv

man iconv should give you more details about options

Also, Import CSV file (contains some non-UTF8 characters) in MongoDb discusses some options for windows.

Community
  • 1
  • 1
anish
  • 482
  • 2
  • 8