-
Notifications
You must be signed in to change notification settings - Fork 8
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
UndefinedConversionError "\xC3" from ASCII-8BIT to UTF-8 within JRuby/Rails/Sprockets dev mode #71
Comments
Perhaps related to SCSS source maps. |
Stack trace says it is this line: https://github.com/ntkme/sass-embedded-host-ruby/blob/0b4cf29cad898ca647017a0921b4641359eb46c6/lib/sass/embedded/host.rb#L55 So I think it is related to the css input. |
Argh, sorry, I pasted a stack trace where I had added a debug log line above in |
@chadlwilson Can you please add a debug line to check the encoding of source with |
Yes, the The problemAfter a bit of luck, and a lot of hacking around, I discovered the problematic character is
So I conclude that, when assets debug is enabled, somewhere in the stack is causing the SCSS to be loaded or parsed differently, with an The root problemDug into Sprockets and found rails/sprockets#669 - similar problem on JS files whose fix made it into Sprockets Without a charset, the default method seems to be to The fixAdding the below at start-up seems to fix the issue. Sprockets.register_mime_type 'application/css-sourcemap+json', extensions: ['.css.map'], charset: :unicode I guess I could submit a PR to Sprockets? But not entirely sure I understand all the consequences of that Again, and this is a little embarrassing - another Sprockets problem mis-attributed to poor |
Given the information you provided, I think the issue is:
|
Reading the test case added in rails/sprockets#669, I think what is happening is that in the dev mode, the encoding registered for the mime type of an output file will determine the encoding set on string for input (
|
Great, thank you for your input 🙏 |
Hi there - similar to #2 after some change I can't trace, I have started getting a persistent failure of a particular stylesheet to compile dynamically in a dev environment. It seems to be fine when precompiling assets, and I can't quite trace what is different between the two setups.
Environment:
MacOS
12.6
MontereyJRuby
9.3.8.0
under Java 17rails
6.1.7
sprockets
4.1.1
sassc-embedded
1.54.0
installed per https://github.com/ntkme/sassc-embedded-shim-rubyPossible problem
I am guessing from #2 that there is some default encoding problem somewhere, but I am not quite sure where to look as the code seems rather different than when #2 was discussed.
I tried forcing Java
file.encoding=UTF-8
in case there is a JRuby default thing going on here, as well as forcing the default encodings at Rails level - seems no difference.The issue seems to be with debug assets as changing to
config.assets.debug = false
inapplication.rb
(or for the specific problematic stylesheet's tag) seems to allow render to work, at least for this particular page.Any workarounds or help to narrow the problem down would be appreciated.
Error Detail
The same top level SCSS asset (
new-theme
) fails to compile withFull stack trace is
The text was updated successfully, but these errors were encountered: