clemg / pythongolfer Goto Github PK
View Code? Open in Web Editor NEWCode golfer and minifier for Python https://clemg.github.io/pythongolfer/
Home Page: https://clemg.github.io/pythongolfer/
License: GNU General Public License v3.0
Code golfer and minifier for Python https://clemg.github.io/pythongolfer/
Home Page: https://clemg.github.io/pythongolfer/
License: GNU General Public License v3.0
Due to a broken check in the codegolf function, non-Latin-1 characters (all those above U+00FF) at odd-numbered positions in the input string have their code point silently truncated to 8 bytes, instead of throwing an error so the user can be notified.
To Reproduce
'ज़'
into input box, which has a non-Latin-1 character in index 1.exec(bytes('嬧‧','u16')[2:])
bytes('嬧‧','u16')[2:]
evaluates to b"'[' "
, which does not match the input code.Expected behavior
Error message displayed about non-ASCII characters, as it is for the input ' ज़'
(space added to put the character into an even-numbered position).
Environment
Additional context
The code causing the issue is here
Effectively c1
(the even-numbered character) is checked but c2
is ignored and subsequently truncated.
Also
Handling of characters from the Latin-1 Supplement block (U+0080 to U+00FF) by this site is unclear. These are non-ASCII characters, but is there a reason to ban them from the input? Shouldn't the check really be > 255
instead of > 127
?
Describe the bug
When the input code contains ". ", the coating code is reversed and sometimes appears in the middle.
For some reasons, it does not happen every time, it depends on the position of the ". " string.
To Reproduce
Steps to reproduce the behavior:
Expected behavior
The result code should appear coated with the decoding python code, but instead we get a reversed string in the middle.
Desktop or Smartphone (please complete the following information):
Edit: also works with "+ " in it.
Theory: Maybe when the "+" or the "." is in an even indice position in the string, the converted char in UTF-16 is a reversing one, it would explain what this happens only in this precise case.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.