I'm running into a strange issue that I can't seem to find in other questions.
The short version of the question is: is there any way to force Bower to install download/save modules using utf-8 encoding?
The long version: I have a file bundle that's built by webpack, and it uses the multiplication symbol (×
) for a close button.
After webpack compiles everything, the chunk of code in question looks like this:
_react2['default'].createElement(
'a',
{ className: 'pn-finalists__close-btn', onClick: clickHandler },
'×'
)
So far so good.
The issue seems to be caused by Bower — and only intermittently. When I install from a GitHub repo using bower install --save user/repo#^0.3.2
, the encoding breaks and the file downloads like so:
_react2['default'].createElement(
'a',
{ className: 'pn-finalists__close-btn', onClick: clickHandler },
'Ã'
)
I tried to prevent this through webpack, but I can't seem to find the part of webpack that changes ×
into ×
(I also tried \u00D7
, with the same result).
But this seems like something that shouldn't be happening with Bower. I've verified that the file does not have the encoding issue on GitHub, so it's happening somewhere during bower install
, unless there's an intermediate step I'm unaware of.
Has anyone seen this before? And if so, is there a way to fix this via Bower's API and/or by disabling the part of webpack that converts unicode/HTML entities into their Unicode characters?
EDIT:
The file that's breaking in transit is this one. (GitHub won't display it in a way that allows me to link to a line number, but if you search for close-btn
, the issue is with the last instance of that term in the file.)