aheckmann / gridfs-stream

Easily stream files to and from MongoDB
MIT License
615 stars 120 forks source link

utf-8 encoding #19

Closed yangpu closed 11 years ago

yangpu commented 11 years ago

I need store unicode data to gridfs, and set encoding = 'utf8' or encoding = 'utf-8' to options before createReadStream and createWriteStream, however, gridfs returns messy code always.

How to support unicode/utf8 encoding for gridfs? thanks.

Reggino commented 11 years ago

Filedata should be stored binary, so the charset should not matter in any way... Maybe your script adds HTTP headers before the response instruct the browser to interpret the file in a different/wrong character set? Could you provide your testscript & file?

Reggino commented 11 years ago

If you need to read the data as text from a different (not unicode) character set, see package iconv in npm