grunt-ver icon indicating copy to clipboard operation
grunt-ver copied to clipboard

Proper use of encoding for hashing international characters.

Open michaellopez opened this issue 11 years ago • 0 comments

The documentation for hash.update() states that if no encoding is given, the argument is expected to be a Buffer.

Like many other "hash tasks" for Grunt, grunt-ver provides the contents of the file as a string to hash.update without any encoding as a second argument, which is incorrect.

The result of this is an incorrect hash for files with international characters in them when no encoding is given to hash.update.

Setting the proper encoding when calling hash.update fixes this.

PS. This plugin could use a bit of refactoring to allow passing options and such. My PR only handles the encoding bit though.

michaellopez avatar Mar 18 '13 08:03 michaellopez