When I use an online converter to decode the image and send it to the API, it works perfectly. Almost like the encoding and decoding work only on Android. Also, when I copy the encoded string and try to decode using an online converter, it doesn't work. pad.length).forEach ĬhunkedSequence, require, and maybe String.repeat can be usefull. But when I decode the Base64 String back to a Bitmap, it displays properly. kotlin-stdlib / kotlin.io.encoding / Base64 / decode. Returns a ByteArray containing the resulting bytes. companion object Default : Base64 Functions Common JVM JS Native 1.0 decode Decodes symbols from the specified source array or its subrange. Base64 decode kotlin How to convert an image into base64 String in Android using Kotlin Web14 ta Aww 2020 Base64 Encode and Decode using Kotlin (Android). Android Bitmap to Base64 String - Stack Overflow Kotlin Base64 Encoding and Decoding. Private val RX_BASE64_CLEANR = ''.toRegex() 1.0 Default The 'base64' encoding specified by RFC 4648 section 4, Base 64 Encoding. code (string, 0) val image codeByteArray.
Didn’t find base64 code that didn’t require importing java.this-or-that, so I tinkered a lil … private const val BASE64_SET = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/'