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

UTF-8 Javascript corrupted when being served #63

Closed
crystalcyril opened this issue Feb 19, 2014 · 4 comments
Closed

UTF-8 Javascript corrupted when being served #63

crystalcyril opened this issue Feb 19, 2014 · 4 comments

Comments

@crystalcyril
Copy link

This issue is similar to issue #62, except it happens in production mode (or non-development mode).

I am not sure if the same thing will happen on other assets (e.g. CSS).

In my case, I have two js file:

  1. application.is, which //=require moment-with-langs, and
  2. moment-with-langs.js, which is included by application.js via directives.

I have read through the code and found that in production mode, the explicitly defined charset in the asset: tag for application.js will not proporgatr to all required files, and therefore the moment-with-langs.js file will not have an encoding value passed (I found it by adding debug output).

Furthermore, the asset code will not properly read the required files using UTF-8, and in the AssetsController, there is no means to specify the character encoding to use when I am trying to fix issue 62.

This also make me thinks that, what if the js/CSS files to serve may not be necessary all in UTF-8 encoding?

@davydotcom
Copy link
Contributor

we have to merge into one unified character encoding. Typically its safe to use UTF-8 as the encoding because ANSI is compatible with UTF-8.

@davydotcom
Copy link
Contributor

Figured out the actual issue. The files were encoded properly but the response encoding was not being set. The response encoding needs to be set to request.characterEncoding then the issue is resolved.

@davydotcom
Copy link
Contributor

Issue is resolved in version 1.5.5

@crystalcyril
Copy link
Author

Wow your response is quick, thank you!

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