Ad

React + Webpack Character Encoding Issues

- 1 answer

I'm currently making a website using ReactJS and webpack to build it.

My text editor is set on ISO-8859-15 encoding and I'm using accented or special chars like é è à ç.

In my html page, I believe I'm using the right configuration:

<meta charset="iso-8859-15">

But special chars are not rendered the right way: Fran�ais instead of Français for instance.

I tried to set charset="utf-8" but nothing changed.

I feel like webpack is building with UTF-8 encoding, which brakes my chars. How could I fix this issue?

Ad

Answer

I didn't find a way to make webpack read input files with an encoding other than UTF-8. I had to set up my project to write source files in UTF-8, and then used webpack-encoding-plugin to output files as ISO-8859-1 or whatever. It worked.

Ad
source: stackoverflow.com
Ad