You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Is your feature request related to a problem? Please describe.
Currently, without modifying Java code, it is impossible to create a custom charset. While Java does have a number of existing Charsets, I am presently dealing with a program that uses a custom charset. Right now, I am using arrays of a custom "Text" enum, but this is rather clunky, and fails at visualization.
Describe the solution you'd like
I would like to be able to import an enum as a charset, or set the display of enums into a string like format.
Describe alternatives you've considered
Maybe formatting for charset_info.xml could be expanded to actually define a custom charset? Admittingly, this might be possible, but given the code, it does not appear to be the case.
Additional context
I have already searched through existing issues, but one only seems to lead to importing java's StandardCharsets, while the other blindly leads to charset_info.xml, without any context as to how this is useful for the current issue.
The text was updated successfully, but these errors were encountered:
From the looks of it, maybe you can implement a new Charset and CharsetProvider and add it to charset_info.xml. Not sure if editing the XML is even necessary because it seems to add charsets discovered from the JVM, unless the char size is multi-byte. I'll be trying this out later.
For the basic case of single-byte character sets, it is pretty simple. All you have to do is build a .jar with your CharsetProvider and Charset and drop it into Ghidra's Ghidra/patch directory. Here's a sample project demonstrating custom CharsetProvider and Charset. There are surely better implementations, but this should do in a pinch. After you drop the .jar into Ghidra, you can right click on a string, select Data -> Settings... or Data -> Default Settings..., and pick your new encoding from the Charset list.
In general, the example/custom charset that @GMMan linked seems like the right direction to take. I'm going to mark the original request as out of scope and close.
Is your feature request related to a problem? Please describe.
Currently, without modifying Java code, it is impossible to create a custom charset. While Java does have a number of existing Charsets, I am presently dealing with a program that uses a custom charset. Right now, I am using arrays of a custom "Text" enum, but this is rather clunky, and fails at visualization.
Describe the solution you'd like
I would like to be able to import an enum as a charset, or set the display of enums into a string like format.
Describe alternatives you've considered
Maybe formatting for charset_info.xml could be expanded to actually define a custom charset? Admittingly, this might be possible, but given the code, it does not appear to be the case.
Additional context
I have already searched through existing issues, but one only seems to lead to importing java's StandardCharsets, while the other blindly leads to charset_info.xml, without any context as to how this is useful for the current issue.
The text was updated successfully, but these errors were encountered: