-
-
Notifications
You must be signed in to change notification settings - Fork 809
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
swf: Fall back to WINDOWS-1252 for text decoding #1499
swf: Fall back to WINDOWS-1252 for text decoding #1499
Conversation
Older Flash files (in this case, Mata Nui Online Game) use WINDOWS-1252 encoding for text. By trying this encoding using the encoding_rs crate if utf-8 decoding fails, the little guards at the lava gate have something to say again.
efafccd
to
171c5b8
Compare
Thanks and welcome! This should be based on the SWF version -- Eventually we want to provide options to specify the locale, and this should also apply to the AVM1 reader, but that will be for future PRs (I'm working on this currently by switching the SWF reader to return byte slices). |
I don't see the SWF version exposed to In short, I do not know this codebase or Rust so I don't know what the appropriate rearchitecturing is to make this work as you described. |
For now, let's remove
|
I've looked at this problem a bit, and I agree that if we want to cleanly support the Would the next step forwards on this for Two options I can think of:
The first one definitely feels easier to manage overall. |
I typed this up, thought about how (for example) string length doesn't get affected by the underlying encoding, and am now thinking that it's actually totally reasonable for us to not bundle the locale with the string type, save the byte, and just require callers/users to provide locale info each time. Especially given how many C strings would be floating in a standard run. |
Yes, my thought is to define an I wasn't sure about bunding the encoding with the SwfStr -- on one hand, the encoding will be the same for an entire SWF, so it makes sense to save the bytes. On the other hand, bundling it may be more ergonomic and allow for impls for I have work on my branch that will help with this by converting the swf Reader to return byte slices for its types; I'll make a PR this week. |
Also, although the specs only specifically mention ANSI and Shfit-JIS, I believe we actually need to support any encoding (Flashpoint specifically has quite a few Big5-encoded SWFs). So the encoding parameter could be an |
Older Flash files (in this case, Mata Nui Online Game) use WINDOWS-1252 encoding for text. By trying this encoding using the encoding_rs crate if utf-8 decoding fails, the little guards at the lava gate have something to say again.
I don't know Rust please don't bully I just wanna play my lego games