memtrip / eos-jvm

EOS libraries for the JVM, designed primarily for Android development.
http://www.memtrip.com
Apache License 2.0
37 stars 19 forks source link

Transfer memo gets cut off with Cyrillic letters #4

Closed ysoftware closed 5 years ago

ysoftware commented 5 years ago

I'm not sure why, but transfer memo gets cut off when cyrillic letters are present. String in memory doesn't get cut off, so it's probably something to do with DefaultByteWriter's method fun putString(value: String).

Here are examples of incorrect transactions:

expected: тест actual: те trx link

expected: тестируем testing 1234567890 actual: тестируем testing 1 trx link

samkirton commented 5 years ago

I reproduced the issue with the following tests

       on("transfer abi model with Cyrillic letters") {

            val transferArgs = TransferArgs(
                "memtripissu5",
                "memtripblock",
                "12.3040 EOS",
                "тест"
            )
            val transferBody = TransferBody(transferArgs)

            val output = transactionWriter.squishTransferBody(transferBody).toHex()

            it("should encode letters correctly as hex") {
                assertEquals("5034c6aeba9ba59200118da7ba9ba592a0e001000000000004454f530000000008d182d0b5d181d182", output)
            }
        }

        on("transfer abi model with Cyrillic letters 2") {

            val transferArgs = TransferArgs(
                "memtripissu5",
                "memtripblock",
                "12.3040 EOS",
                "тестируем testing 1234567890"
            )
            val transferBody = TransferBody(transferArgs)

            val output = transactionWriter.squishTransferBody(transferBody).toHex()

            it("should encode letters correctly as hex") {
                assertEquals("5034c6aeba9ba59200118da7ba9ba592a0e001000000000004454f530000000025d182d0b5d181d182d0b8d180d183d0b5d0bc2074657374696e672031323334353637383930", output)
            }
        }
samkirton commented 5 years ago

This is fixed in beta01.

The following tests verify the bug fix: