From: Èãîðü Ïàëàãóòà (pala85_at_[hidden])
Date: 2008-07-14 04:06:19
I have the following code:
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;
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?