-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
add ability to specify content-type charset utf-8 #432
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
Comments
you can add a meta tag into the HTML. |
What about for assets that arent HTML? |
I notice that webpack-dev-server's bundle.js is encoded using Windows-1252 while webpack's build output .js files are encoded in UTF-8. This discrepancy is causing some characters to show up one way during development but another on build. How do you force webpack-dev-server to create bundle.js using UTF-8 encoding? Adding a meta tag in HTML has no effect. |
@sokra how do you that? |
Does this also happen when outputting a bundle with |
Is this still happening, and if so, can someone provide more info? |
Did it not repro for you? On Fri, Sep 9, 2016, 9:34 PM Kees Kluskens [email protected] wrote:
|
No, I can't find a simple way to reproduce this. A PR is welcome. |
I'm not on my.comouter for a few days. what content type header do you see on the bundle request? |
The content type header for I probably don't have this problem because I'm on macOS. |
I'm on Mac too. :) It's only non ASCII (?) special characters that mess you up. Yes. I'm assuming you can look up the content type and dynamically add. That would be great! |
I added |
In JavaScript? On Sat, Sep 10, 2016, 8:40 AM Kees Kluskens [email protected]
|
Yeah, in I noticed that the Javascript file is called with |
Ah. Right what is the header on your html file? I believe the browser On Sat, Sep 10, 2016, 8:54 AM Kees Kluskens [email protected]
|
Interesting, the header of the html file is |
Yeah I don't think we use content base. We have a couple of different I believe angular is a good example of a special characters that fails Apologies for typos. On Sat, Sep 10, 2016, 8:59 AM Kees Kluskens [email protected]
|
Technically this is an issue in webpack-dev-middleware, that package takes care of making a response. This line is responsible for generating the I'm not sure though if we can just add |
Yeah how do you look up charset webpack is using? On Mon, Sep 12, 2016, 10:17 AM Kees Kluskens [email protected]
|
As far as I can tell, it's only possible to change it with webpack-encoding-plugin. This PR from the webpack repo also assumes utf-8. |
Ah is there a constants file we can just reference? Then we can fix the pr? On Mon, Sep 12, 2016, 10:28 AM Kees Kluskens [email protected]
|
I'm not sure yet, but after that PR linked above, I'm thinking webpack always assumes utf-8. |
Is there any workaround or fix to this yet? After being built with webpack: Being served with webpack-dev-server: I can help investigate / fix this if it would be helpful. I wouldn't class this as a "Nice to Have": it's making it impossible to test my site properly without pushing it to a staging environment. |
@callumacrae, yes it would be nice if you can help with this. The real issue is in webpack-dev-middleware, to be precise on this line. Probably, it is enough to add You could test out if that works. If it works, send a PR. We would still need to find out if it breaks stuff, but we could do a beta release and let some people test it. If it doesn't work, search for other places where |
@SpaceK33z: That fixes the issue for me. I've sent a PR: webpack/webpack-dev-middleware#136 |
Is it possible to define the Content-Type with a charset of UTF-8 for responses? I don't see it when webpack-dev-server serves content from the content base. This causes encoding issues because the bundle.js is UTF-8.
The text was updated successfully, but these errors were encountered: