rails / sprockets

Rack-based asset packaging system
MIT License
932 stars 792 forks source link

Ensure asset source is utf-8 encoded #794

Closed AyoubEssrifi closed 8 months ago

AyoubEssrifi commented 8 months ago

This is a modest fix for the issue mentioned here #498.

brenogazzola commented 8 months ago

Hey @AyoubEssrifi would mind explaining why you gave up on this? Propshaft has the same problem and I was considering forcing UTF-8 encoding there too, so I'm wondering you figured out something that would mean this approach is going to cause problems.

AyoubEssrifi commented 8 months ago

@brenogazzola For some reason, when i deleted the extension part of some Coffeescript or Coffe/ERB files in the main application.js:

Bad example:
//= require example.js.coffee.erb

Working example:
//= require example

that gets called on the manifest.js, Sprockets was able to correctly handle encoding and didn't have any issues with it. This was not mentioned anywhere on the docs.