Giter Site home page Giter Site logo

base122-java's Issues

Decode and Encode test fail for me

I cloned the repo and ran the test package. I like the Monte-Carlo nature of the tests!

Decoder:

Failures:
DecoderTest.decode:16 arrays first differed at element [0]; expected:<68> but was:<-2>

Encoder:

Failures:
EncoderTest.testVector1:20 expected:<[��v�� J#�(��� ���m0��� @0�Ɔ�A``@( ƅ�!�PP�����q 0�ƅBaPtJ�ʆd1X, �21�R*�F#ri@Z(� %�I#�[��8��Ƅ�B0P(ҨʅCρ P(�ƅ�A P(�ƅ�A P(�ƅ�A P(�ƅ�A P(�ƅ�A P(�ƅ�A P(�ƅ�G���B���È@�D�@?| ¶�à��������� ���Ao~��À ����������4�à�� ��S=U�oRQʺMf+B0GJTcP>Q;�Py֦Mz�L��GN!j�9TV��ngOC�M�k:=E>s(+�8g�| À��@ ������� ��� �ΰ)�(Ι�{ ��� P��f9MS<o�j6To�fy3U%r+BeS)y�g<�O>dSD8-A�i9Xn5�sZC6L���1)k�mnXU2JY!H%Җ[2x!RK0=*~�hd}Jí+^7HT�[)I����(�m���*Dsy�B<yӵ�0>s�˅6 Ohl�Xa TK,S�rӎ��^e�>�Zu��.hZ}Ӎ!^�m1r U�| ¨�À��������~h�À� |���q� D��������� ?{ ��À'��D������Á@@8�������΢ DD H���ң8d҃� e�Pl?}P��Àãx�pw�֥c�yF}kFo]4I4]/Y�T<R֍Q c{-ӥ5VA0W<�DÈX%)�<Ӵ�C9sί>)S4>JM�1N6�ƂW,BU��yP ^=ǏBm�JE���lU2Y_p�(�-JBx(J U%4<_p�.'GQ��Y�@�cU.jHnc:kƱfA4:Pm@nmH^Ɣ/o_Fs.�GyM'� +63�b_�q�À��À ��������À�� E�Q0ְ�ˇ#�m�����H>h2n 4q�J�{Q@zgf>�%@<.Ҩ7Oj/gz)��yRZ+aDVZh)?Ά��Ƃ�F�D�WB�� ?8(��}9RxBmhg8�O�-M?;6�pB4<j�5)s�0W֗��HiN2:{lRhKiaL?lXVq�v7/m!uj+h4gpM�L=֮g|ãEDS �NPh2^+��9Bw3V(k�o6���p+c֥_v^�(�2�IL^AG���;K+�2�uǭt5)(Pt2aO0n˕Ϣlʺvs�b�! �0CADn�;1ƍG�8|EM~b�SsfU'�4�à��������Pq �as�K�| ¨�À��������~h�À� | ��q� D��������� ?{ ��À'q��D����À��������Ҕ���Q8d4���ΐp|?}P��À�xBkY9d�p>+Av�ΕSk�P�^X�a9y�i� �+=F<viґʟ8f6@���4?;���S?+.և�Ps�לu�%�2Mog˸mW�q_p�rҷ�:��)@� F6 ]ֿE�ƿ+cƗ1*�:SK|3R,/Mo-ҝLl�m(H{�pzLAD�fm�@�� PMʍa<;a�-.2�zo�à2E�I? |3Ij�E!���,�e �ǥ�u��Vgeiқnao�xN� ]�(8_'vq8-0-#�n�^L'΍�...> but was:<[�v�~� J#�(��� ���m0��� @0�Ɔ�A``@( ƅ�!�PP�����q 0�ƅBaPtJ�ʆd1X, �21�R�F#ri@Z(� %�I#�[�`�8��Ƅ�B0P(ҨʅCρ P(�ƅ�A P(�ƅ�A P(�ƅ�A P(�ƅ�A P(�ƅ�A P(�ƅ�A P(�ƅ�G���B���È@�D�@?| ¶�à��������� ���A`o��À ����������4�à�� ��S=U�oRQʺMf+B0GJTcP>Q;�Py֦Mz�L��GN!j�9TV��ngOC�M�k:=E>s(+�8g�| À��@ ������� ��� �ΰ)�(Ι�{  ��� P��f9MS<o�j6To�fy3U%r+BeS)y�g<�O>dSD8-A�i9Xn5�sZC6L���1)k�mnXU2JY!H%Җ[2x!RK0=~�hd}Jí+^7HT�[)I����(�m���Dsy�B<yӵ�0>s�˅6 Ohl�Xa TK,S�rӎ��^e�>�Zu��.hZ}Ӎ!^�m1r U�| ¨�À��������h�À`� |���q� D��������� ?{  ��À'��D������Á@@8�������΢ DD H���ң8d҃� e�Pl?}P��Àãx�pw�֥c�yF}kFo]4I4]/Y�T<R֍Q c{-ӥ5VA0W<�DÈX%)�<Ӵ�C9sί>)S4>JM�1N6�ƂW,BU��yP ^=ǏBm�JE���`lU2Y_p�(�-JBx(J U%4<_p�.'GQ��Y�@�cU.j`Hnc:kƱfA4:Pm@nmH^Ɣ/o_Fs.�GyM'� +63�b_�q�À��À ��������À�� E�Q0ְ�ˇ#�m�����H>h2n 4q�J�{Q@zgf>�%@<`.Ҩ7Oj/gz)��yRZ+aDVZh)?Ά��Ƃ�F�D�WB�� ?8(��}`9RxBmhg8�O�-M?;6�pB4<j�5)s�0W֗��HiN2:`{lRhKiaL?lXVq�v7/m!uj+h4gpM�L=֮g|ãEDS �NPh2^+��9Bw3V(k�o6���p+c֥_v^�(�2�IL^AG���;K+�2�uǭt5)(Pt2aO0n˕Ϣlʺ`vs�b�!~ �0CADn�;1ƍG�8|E`Mb�SsfU'�4�à��������Pq �as�K�| ¨�À��������h�À`� | ��q� D��������� ?{  ��À'q��D����À��������Ҕ���Q8d4���ΐp|?}P��À�xBkY9d�p>+Av�ΕSk�P�^X�a9y�i� �+=F<viґʟ8f6@�`���4?;���S?+.և�Ps�לu�%�2Mog˸mW�q_p�rҷ�:��)@� F6 ]ֿE�ƿ+cƗ1�:SK|3R,/Mo-ҝLl�m(H{�pzLAD�fm�@�� PMʍa<;a�-.2�zo�à2E�I? |3Ij�E!���,�e �ǥ�u��Vgeiқnao�xN� ]�(8_'vq8-0-#�n�^L'΍�...>

Decoder code issue

https://github.com/patrickfav/base122-java/blob/master/src/main/java/at/favre/lib/encoding/Base122.java#L124

To loop through the UTF-8 encoded string, you should use:
char[] utf8Bytes = base122Data.toCharArray();

instead of:
byte[] utf8Bytes = base122Data.getBytes(StandardCharsets.UTF_8);

Because a byte can only represent a partial UTF-8 character and the range of a byte is -128 to 127, so in line 128, the if statement will always be false (a byte will never larger than 127).

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.