On Tue, May 19, 2015 at 2:17 AM, Daniel Vrátil <dvra...@kde.org> wrote:

> On Monday, May 18, 2015 07:32:54 PM Robby Stephenson wrote:
> > In the process of porting Tellico to KF5, one of my unit tests that
> > depends on KCodecs::base64Encode() started to fail. After poking at it a
> > little bit, my impression is that KF5::KCodecs is including a newline at
> > the end of the byte string, where the kdelibs4 version didn't.
>
> You are correct - when the encoding finishes and the quartet is finished a
> (CR)LF is appended to the end in Base64Encoder::generic_finish().
>
> In KF5 the base64 code was brought from KMime (email parsing library from
> kdepimlibs), where appending a newline after encoded base64 data makes
> sense.
> I don't know if we can just change the behaviour like that since it has
> already been release, but for sure we could add a new argument to
> KCodecs::base64Encode() to skip the trailing newline.


At the very least, it should probably be mentioned in the class
documentation and porting notes as a behavior change. As to adding a
newline, I'll leave that up to you or others to determine. I was just going
to chop(1), but Thiago's suggestion works perfectly.

On Tue, May 19, 2015 at 12:10 AM, Thiago Macieira <thi...@kde.org> wrote:

> There's QByteArray::toBase64. You may want to use that instead.


Ahh, thanks, I missed that and it's an easy solution.

Robby
>> Visit http://mail.kde.org/mailman/listinfo/kde-devel#unsub to unsubscribe <<

Reply via email to