Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

File encoding changes on replace #23

Closed
nabils opened this issue Oct 9, 2014 · 3 comments
Closed

File encoding changes on replace #23

nabils opened this issue Oct 9, 2014 · 3 comments

Comments

@nabils
Copy link

nabils commented Oct 9, 2014

I am trying to run a replace with overwrite option set to true. This works but for all files including the ones where there were no matches it will change the file encoding from UTF8 to unicode. Any ideas why this is happening? Ideally I would not want the encoding to change at all, especially for files with no matches should not be touched.

Thanks

@yoniholmes
Copy link
Owner

Hi Nabil,

Thanks for your message. I wanted to ask are you seeing any faulty behaviour as a result of using grunt.text.replace? Also, how are you checking what the file encoding is? Note that Unicode is a character set and UTF-8 is an encoding that uses the Unicode character set. See the difference between UTF-8 and Unicode.

As for grunt.text.replace, it uses grunt.file.copy to write files, both for overwriting and creating new files. Grunt.file.copy uses UTF-8 as a default character encoding, so all files should be UTF-8. You can see the replacement code here.

Let me know if you track down the issue any further, and if you need any help. If anything needs changing feel free to fork and submit a pull request.

I'm going to mark this issue as closed but reopen if you feel there still exists a problem, and if you could provide a bit more information about the problems you're seeing.

Thanks,

Jonathan

@nabils
Copy link
Author

nabils commented Oct 14, 2014

Sorry didn't explain very well but this is related to #16

@nabils
Copy link
Author

nabils commented Oct 14, 2014

Are you able to merge this pull request and release a new version to npm please?
This is the only way to stop it updating every file regardless of if there were changes.

#16

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants