Bug report: Substitution does not work with UTF-8 encoded characters
LukeSerne opened this issue · comments
Luke Serné commented
Describe the bug
The "Substitute" operation does not interpret UTF-8 encoded strings properly. It doesn't work properly when any of the plaintext alphabet, the ciphertext alphabet or the input contains UTF-8 encoded strings.
To Reproduce
- Go to this link
- See that the output is not the expected
01010101
, but instead contains a warning and01⚽01⚽01⚽01⚽
.
Expected behaviour
The output should be 01010101
.
Additional context
From a quick look at the source code, it seems there are two causes of this behaviour.
- The way the input is iterated over (using a for-loop up to
input.length
). - The way the plaintext and ciphertext are transformed using
Utils.expandAlphRange
.