Skip to content
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

Physical Attack Table Encoding Error (Push attack) #1111

Closed
jskelcher opened this issue May 29, 2022 · 3 comments · Fixed by #1112
Closed

Physical Attack Table Encoding Error (Push attack) #1111

jskelcher opened this issue May 29, 2022 · 3 comments · Fixed by #1112

Comments

@jskelcher
Copy link

jskelcher commented May 29, 2022

Environment

Both MekLab 0.48.0 & 0.49.8
MekHQ bundle
Windows 11
Java vendor Eclipse Adoptium 11.0.13

Description

When exporting to PDF: A Mech with tables, the Damage entry for the Push Attack in the Physical Attacks table is displayed as — rather than 0. This occurs in both Acrobat and in Chrome's PDF renderers. Tested with Eurostile and Arial font families.

Same issues occurs when printing a Mech directly from MegaMekLab itself.

megameklablog.txt
2022-05-28 20_19_54-Blackjack BJ-3 pdf - Adobe Acrobat Pro DC (32-bit)

@raelik
Copy link
Contributor

raelik commented May 31, 2022

This is happening because it's trying to print an em dash that was just dropped into the code as a UTF-8 literal, which Java doesn't support:

addRow(bundle.getString("push"), "-1", "—");

It's being interpreted as 3 distinct bytes (0xE2, 0x80, 0x94) and translated with presumably the default system encoding, I see something slightly different on my sheet. The fix will almost certainly involve using a Java Unicode literal, like this:

addRow(bundle.getString("push"), "-1", "\u2014");

There may be other necessary steps after that, like ensuring the output encoding when printing has that character. Given that we both see something slightly different here, I don't think that's the case. UTF-8 would probably be the best option.

@raelik
Copy link
Contributor

raelik commented May 31, 2022

Actually, looks like that was all it needed. Just tested it, and that worked. I'll submit a PR. I realized the only reason mine looked slightly different than yours @jskelcher was that I was using a custom font.

@raelik
Copy link
Contributor

raelik commented May 31, 2022

Here's what it looks like in my fixed branch:

image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants