-
Notifications
You must be signed in to change notification settings - Fork 96
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
Encoding::UndefinedConversionError from UTF-8 to US-ASCII while minifying JS in production #76
Comments
Thanks for the detailed report. I think the encoding issue might be related to querying via http to get assets, we should get them from the disk directly when possible. Might be related to #68 too |
(and or detect & deal with encoding properly, I think your fix will work only for files encoded in ISO-8859-1) |
ASCII-8BIT to UTF-8 conversion can be done this way without errors. So, files encoded in ISO-8859-1, US-ASCII, ASCII-8BIT and UTF-8 can be converted to UTF-8 encoding without errors. |
Unfortunately force_encoding is not (1.8.7 compatible](http://ruby-doc.org/core-1.8.7/String.html) and I doubt doing this is the real solution as force_encoding does not change anything. We should add a test I adress this issue with a cleaner solution. |
Just bit by the same bug. Any progress? |
I haven't work on this issue, but would sure accept a pull request on it. I doubt replacing the package snippet with |
just stumbled upon this right now, too. why is it trying to convert from utf-8 to ascii anyway? everything is written in utf-8 on my server (hopefully all vendor js, too), output to clients is utf-8. why does it want to convert from utf-8 to ascii? |
I do not have any update on this issue but it should indeed be resolved and we have to find a clean solution for this issue. |
I could get rid of the error by setting the correct I could do this for apache with phusion passenger by |
I'm also encountering this issue, is there something new? (Setting the env var LANG didn't work in my case. |
Can an option be provided to specify which encoding should be used instead of forcing it to the Encoding.default_external? |
I encountered this issue today, it would be nice to get a fix thanks |
Could you report your full stacktrace @willmoss ? Is it exactly the same as the original issue? |
Just encountered this in production as well. |
@papanikge unfortunately, this repo is not maintained anymore. see #197 there is many other better up to date assets manager for sinatra |
The
assets
part of my app:I'm using
slim
as my templating engine. The app is a "modular" Sinatra app. Not sure if these change the behaviour.The offending part is at the line https://github.com/rstacruz/sinatra-assetpack/blob/master/lib/sinatra/assetpack/package.rb#L101
This is unrelated to the
yui
compressor since changing that to the default compressor also triggers this error. The issue with this error is when compiling/compressing the assets on a per-request basis, the javascripts files won't get sent to the browser:Changing the entire method to the below snippet corrects this behaviour.
Tested this with 1.8.7 (Mac system ruby), 1.9.3-p327, rubinius 1.2.4. Here's the commit in my repo kgrz@4810b71 Will send a PR if this gets tested thoroughly. The tests pass without any error but there are failures which were there before changing this method.
I'm guessing the reason for this happening only in production is that the
combined
method is not used in other environments.Another point to note is that this setup ( assets in
public
directory) cannot used if you want to build the assets first since by default, the built assets get copied intopublic
directory.Here's the stacktrace:
The text was updated successfully, but these errors were encountered: