Overview
Features
Download
Documentation
Community
Add-Ons & Services

Poco::Base64Decoder bug?

Please post support and help requests here.

Poco::Base64Decoder bug?

Postby sgsoft » 30 Nov 2013, 09:27

The string "select count(*) from devicestate" BASE64 encode is "c2VsZWN0IGNvdW50KCopIGZyb20gZGV2aWNlc3RhdGU=".

Code: Select all
std::string s("c2VsZWN0IGNvdW50KCopIGZyb20gZGV2aWNlc3RhdGU=");
      std::istringstream istr(s);
      Poco::Base64Decoder d(istr);
      std::string result;
      d>>result;
      cout<<result<<std::endl;
      return 0;


above code will output "select". Maybe this is a bug?

POCO lib 1.4.6~ 1.5
sgsoft
 
Posts: 34
Joined: 03 Jul 2010, 12:26

Re: Poco::Base64Decoder bug?

Postby guenter » 30 Nov 2013, 11:35

This is not a base64 decoder bug. The >> stream extraction operator for std::string will stop reading at the first whitespace and thus is not suitable for reading strings containing whitespaces.
guenter
 
Posts: 1165
Joined: 11 Jul 2006, 16:27
Location: Austria


Return to Support

Who is online

Users browsing this forum: No registered users and 2 guests