Two small changes to get Test2 to fully work on EBCDIC systems.#1077
Conversation
87eeb1f to
5ae1a9a
Compare
I no longer remember why I increased the TERM size. I suspect that isn't necessary. An alternative could be to use "\cA", \cB, \cC, \cD instead of \x01 etc. These are possibly more mnemonic; I don't understand the test well enough.
The 65 here is ASCII-centric; it is the ord("A"). Map the whole result
with a character set translation call to get it to work on any character
set. (The mapping is optimized out on an ASCII-based system, so adds no
overhead there.)
|
|
||
| for (1 .. 100) { | ||
| my $postfix = join '', map { chr(rand(26) + 65) } 1 .. 32; | ||
| my $postfix = join '', map { chr(utf8::unicode_to_native(rand(26) + 65)) |
There was a problem hiding this comment.
Do we need to insure the utf8 package is loaded first, is there a minimum perl version this works for?
There was a problem hiding this comment.
I did some testing and it looks like we do not need to load utf8, and that this works back to 5.8. I will merge, then add some logic to skip the call on 5.6, but only cause it is not difficult, and there are still people using modern Test2 on 5.6 (yikes)
There was a problem hiding this comment.
Yes, it utf8: is always loaded, since 5.8. It's fine to not support EBCDIC before then. I haven't looked at what you may have done about 5.6, but I would just create a sub, say to_native that is defined to return its input for earlier than 5.8, and calls unicode_to_native for later. Hence no conditionals are added except for setup.
No description provided.