binpp icon indicating copy to clipboard operation
binpp copied to clipboard

io:format string rendering for bytes >= 0x8E

Open mcesaro opened this issue 4 years ago • 1 comments

I found an issue when rendering strings containing bytes >= 0x8E with io:format("~s"), at least when beam is started with the default latin1 printable_range/1. To fix it, I added an additional condition in the guard inside the print_bucket/1 function at line 136:

Code when Code >= ?SPACE, Code =< 16#7F -> Code;

Without the additional condition: 0001 30 01 07 06 68 45 45 68 08 01 72 27 39 10 20 8F 0...hEEh..r'9. With the condition: 0001 30 01 07 06 68 45 45 68 08 01 72 27 39 10 20 8F 0...hEEh..r'9. .

Also: Before: 001C 00 00 00 0C 22 64 05 00 00 06 6D 36 34 10 9E 24 ...."d....m64..÷.2.ÿ..r... 001E 1E FD E6 00 A2 26 B4 0A 00 00 6E 00 92 18 00 00 .ýæ.¢&´...n.... 001F 93 FF 4D C0 7F 03 06 1F 17 ÿMÀ^....

After: 001C 00 00 00 0C 22 64 05 00 00 06 6D 36 34 10 9E 24 ...."d....m64..$ 001D 00 0F D0 10 F7 16 32 16 FF 19 93 00 72 01 11 17 ......2.....r... 001E 1E FD E6 00 A2 26 B4 0A 00 00 6E 00 92 18 00 00 .....&....n..... 001F 93 FF 4D C0 7F 03 06 1F 17 ..M.^....

mcesaro avatar May 18 '20 08:05 mcesaro

@mcesaro Thank you. Could you please rebase your work in this PR? I'm seeing my commits from gh-pages branch.

aerosol avatar Jul 01 '20 06:07 aerosol