简体   繁体   中英

Why can't Dart decode base64 from Crystal?

为什么 Dart 使用 Crystal Lang 的 base64 产生错误“位置 61 处的无效字符”?

The default Crystal lang Base64 encoding won't work in Dart or Flutter. This is because it doesn't use strict encoding by default, inserting newlines every 60 characters. To Dart, these newlines are unknown characters. So, in short, you have to use Crystal's Base64.strict_encode method. This will encode without special characters. Dart has no method to ignore the special characters so this is 100% necessary to make it work. https://crystal-lang.org/api/0.35.1/Base64.html#strict_encode(data,io:IO)-instance-method

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM