RFC2045[https://www.ietf.org/rfc/rfc2045.txt]中有规定:
The encoded output stream must be represented in lines of no more than 76 characters each.
Base64一行超过76字符后会自动添加回车换行符。
当编码一个长字符串时,会出现每隔76个字符添加一个回车换行符,这会影响到后续的处理,问题根源就是回车换行符,所以删除就好了
在shell下可以通过下面指令去掉base64中的回车换行符:
key=`echo -n \{\"keyaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\"\} | base64 | tr -d "\n"`
概述RFC2045[https://www.ietf.org/rfc/rfc2045.txt]中有规定:The encoded output stream must be represented in lines of no more than 76 characters each.Base64一行超过76字符后会自动添加回车换行符。当编码一个长字符串时,会出现每隔76个字符添加一个回...
原来是RFC2045中有规定:
The encoded output stream must be represented in lines of no more than 76 characters each.
Base64一行不能超过76字符,超过则添加回车换行符。
结合前面博客说的“有回车符,导致...
BASE64 是一种编码方式, 是一种可逆的编码方式.
编码后的数据是一个字符串, 包含的字符为: A-Za-z0-9+/
共 64 个字符:26 + 26 + 10 + 1 + 1 = 64
其实是 65 个字符, ...
图片转Base64数据
m_imagePath = QFileDialog::getOpenFileName(this, tr("select image"), "./pic/",
tr("Image Files(*.jpeg *.jpg *.png *.bmp *.pgm *.pbm);;All(*.*)")); //选择图片
ui->imageDataPath->setText(m