profile
viewpoint

Ask questionsArgumentError: unknown encoding name: ascii-8bit

I have a bizarre issue and was hoping you might be able to shed some light on it. I have a project that I'd like to use the rouge syntax highlighter with, so I'm using rutie to interop with ruby.

In all my tests before integrating the code into my main project, rutie + rouge was working fine. I VM::init() and VM::init_loadpath() and then eval a small ruby file I wrote and use the class inside of it to interact with rouge, and that all works.

However, when I moved this code into my main project, a most peculiar error occurs: the title of this issue. So, in my main project, I added the below to the very start of main().

rutie::VM::init();
rutie::VM::init_loadpath();
eprintln!("{:#?}", rutie::Encoding::find("utf-8"));
eprintln!("{:#?}", rutie::Encoding::find("ascii-8bit"));
eprintln!("{:#?}", rutie::Encoding::find("us-ascii"));

Surprisingly, utf-8 and us-ascii both exist, but ascii-8bit does not.

This appears to be an issue specifically with the way my binary is compiled, as different ruby versions and different environments (this is being run in a docker container, but building running the binary on my actual computer results in the same) produce the same error. When I run that snippet above in a plain project with just a rutie dependency and no other code, it works fine.

Note that running the binary in the docker container will exhibit the error, but I can also start irb in the same container and verify that the ascii-8bit encoding works fine, so I'm pretty baffled.

Is there something that could be happening during compilation or linking that could be screwing this up? That's all I can think at this point, considering it's just this binary that is afflicted (and across platforms). Maybe it's something completely different! Hopefully you have some input I haven't thought of.

danielpclark/rutie

Answer questions ascclemens

Yes.

useful!

Related questions

No questions were found.
Github User Rank List