Boost logo

Boost Users :

From: Stefan Strasser (sstrasser_at_[hidden])
Date: 2005-03-10 21:04:18


Hi,

I need to write a std::wstring which can contain binary data like \0 to
a xml attribute, so I'm converting it to base64 but I have problems
decoding it:
typedef
transform_width<binary_from_base64<std::string::const_iterator>,32,6>
decode;

std::wostringstream out;
std::copy(decode(in.begin()),decode(in.end()),std::ostream_iterator<wchar_t,wchar_t>(out));

is this a correct way to decode base64?
it works, but only if (bits % 6 == 0).
otherwise the program is abort()ed due to an exception.

the string was encoded by
base64_from_binary<transform_width<std::wstring::const_iterator,6,32> >

Thanks,

-- 
Stefan Strasser

Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net