Trytes and Bytes
How to fit the square peg in the round hole
Native Unicode strings

Native Unicode text ( chars):

 

The legacy method is using asciiToTrytes, making
2 tryte chars for each byte.

The compressed method is shifting the bits of the byte8 into an array of byte3 (0-7), so that is fits better in a tryte2 (0-8).

A good idea, but doesn't save much on length.

Legacy method for a tryte6 string ( chars):

Compressed method for a tryte6 string ( chars):

Square pegs and round holes

The bit buckets come in sizes 1, 2, 4, 8, 16, 32, 64, etc.
The trit buckets come in sizes 1, 3, 9, 27, 81, 243, 729, etc.

The IOTA asciiToTrytes .toTrytes() puts each byte into a tryte6 (0-728), which "wastes" more than half of what the tryte6 bucket can hold.

Byte 0, becomes '99'; counting up 'A9', 'B9', up to the largest byte 255, which becomes 'LI'.

Any tryte from 'MI' and up to 'ZZ' cannot be converted back into a byte. Basically. because a byte cannot fit the values from 256-728.

Native tryte string

Native tryte3 string:

Encoded as bytes:

Native tryte3 strings, shifted to tryte5 arrays, before encoded as bytes.

 

NB! Don't insert your actual IOTA seeds here, unless you do it offline in a secure environment.