From: Robert Ramey (ramey_at_[hidden])
Date: 2008-07-14 12:54:18
I struggled with this issue regarding base64 when I made the serialization
I never felt I found the right way to address it. I did manage
to address in the serialization library by reading only thie required
Unfortunately, I think the current implemetation also breaks more iterator
rules than it should.
So I would like to see a clean fix for this to make it useful as
a more general purpose tool.
I hadn't thought of a padding filter - maybe that's a worthy idea.
So I havn't got a lot more to say about this for now.
????? ???????? wrote:
> I have the following code:
> #include <boost/archive/iterators/binary_from_base64.hpp>
> #include <boost/archive/iterators/base64_from_binary.hpp>
> #include <boost/archive/iterators/insert_linebreaks.hpp>
> #include <boost/archive/iterators/remove_whitespace.hpp>
> #include <boost/archive/iterators/transform_width.hpp>
> #include <string>
> #include <exception>
> #include <iostream>
> int main()
> using namespace boost::archive::iterators;
> transform_width< std::string::const_iterator, 6, sizeof( char ) * 8 >
> remove_whitespace< std::string::const_iterator >
>> , sizeof( char ) * 8, 6
> std::string hello_ = "hello";
> std::string base64_hello_( to_base64_type( hello_.begin() )
> , to_base64_type( hello_.end() ) );
> std::cout << base64_hello_ << std::endl;
> std::string hello_recovered_( to_binary_type( base64_hello_.begin() )
> , to_binary_type( base64_hello_.end() ) );
> std::cout << hello_recovered_ << std::endl;
> catch ( const std::exception& e_ )
> std::cerr << e_.what() << std::endl;
> return 0;
> During base64 decode we have following exception: "attempt to decode
> a value not in base64 char set".
> We have the problem because source string hello_ = "hello", has
> length % 3 != 0, otherwise we don't have this exception.
> As I know in this case we should add appropriate number of special
> symbol like '='.
> I can add '=' manually, but boost base64 decode can't process them,
> and we also have exception
> If we have insert_linebreaks/remove_whitespace filter perhaps we also
> should have some symmetric filter for text padding? Do we have
> padding filter in boost? Or perhaps it will be in future?
> Unsubscribe & other changes:
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk