4 ms·
Every Python program should be tested with Emoji characters, they're a real torture test.
by mark-r 7y ago
Every Python program should be tested with Emoji characters, they're a real torture test.
- WorldMaker 7y agoEvery program in general should be tested with Emoji characters at this point.
- mark-r 7y agoNot a bad idea, but I think Python is more likely to have hidden bugs that this will uncover. A language that accepts bytes as input and emits the same on output will probably work fine on UTF-8 for example.
- WorldMaker 7y agoThat's the Python 2 mentality and a large part of this discussion was that it didn't work in hindsight, that you can't just be "encoding oblivious", but it usually doesn't show up as an obvious problem until you least expect it. Our input and output devices are aren't always homozygous on byte encoding (and quite possibly very rarely are; we have decades and decades of kludges around this), and testing every program with Emoji has become one of my favorite pastimes for finding failure cases.
- slavik81 7y agoNote that you need to test on every platform, as the default file encoding may vary. I missed that bug in part because it worked correctly on Linux.
- mark-r 7y agoGood point. I do almost all of my Python on Windows where it's much easier to get an error.