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
Limited encodings available to Ruby #1613
Comments
The 64-bit Mac build should use your system Ruby, actually (not one you've installed through a package manager, though). Can you run devel/lsmem and paste its output to see what Ruby is loaded? |
That's weird, it should definitely list something else with "ruby" in its name, besides hack/plugins/ruby.plug.dylib. Did you run devel/lsmem before all of the plugins had loaded? Could you try running it after running some Ruby code in DFHack? Here's the list of files the Ruby plugin tries to load on macOS: Lines 330 to 331 in 289e0df
You could try to see if either of these exist, and what Ruby version they correspond to if so. |
After running ruby code, I tried running unmodified dfhack, also in /Applications, and same result. How do I run devel/lsmem before plugins loaded? Running
|
Sorry, I was asking you to run The "bus error" is a crash, which is definitely not supposed to happen, and isn't good. Does it also occur if you try to run Ruby code in DFHack (last paragraph)?
|
I did run after plugins loaded I think, in dfhack prompt. I guess the way to run before is in init file. I do not know how it would be possible to not run after plugins load. Copying the system library to |
Yeah, I'm also not sure what I meant about running something before plugins load. I know it's possible to interact with the DF window before all plugins have loaded, since it takes some time, but I don't think you can interact with the console that early. Disregard. Out of curiosity, what does It seems that we still use Ruby 1.8.7 on Linux (and 32-bit Windows, I think), which doesn't even have the built-in
We should probably standardize on a single version of Ruby across platforms (update: see #1718). Evidently we can't rely on the system Ruby on macOS behaving properly either. I'm not sure how complicated it'll be to build I assume "IBM437" is what DF+DFHack refer to as CP437, yes? We do have existing functions to convert between that and UTF-8, but they're currently only available to C++ and Lua. It shouldn't be hard to expose them to Ruby, although I'm far from an expert on how Ruby encodings work. |
I see. Thank you. Is there a difference between at the prompt
I have been using encoding conversion in Lua, but Lua is frustrating. If I write conversion in Ruby I will share. |
The The Ruby plugin will only look for the two libraries I linked earlier on macOS (the one in If you're interested in adding encoding conversion, these are the relevant functions: dfhack/library/include/MiscUtils.h Lines 399 to 401 in 289e0df
And here's an example of a C function in the ruby plugin that takes a string: Lines 566 to 573 in 289e0df
and one that returns a string: Lines 856 to 860 in 289e0df
|
Perhaps related to #1549, running
rb puts Encoding.list
in dfhack gives only very few encodings, making it very annoying to translate from IBM437.On Mac 10.15.5 (installed ruby 2.6.3p62, but I guess dfhack runs its own).
The text was updated successfully, but these errors were encountered: