Overview
Features
Download
Documentation
Community
Add-Ons & Services

Poco::HexBinaryDecoder allways removes blanks.

Please post support and help requests here.

Poco::HexBinaryDecoder allways removes blanks.

Postby throstur62 » 11 Jul 2014, 15:44

Hi,
It seems impossible to let Poco::HexBinaryDecoder decode blank/tab
Example:
Poco::HexBinaryEncoder encoder(output);
Poco::HexBinaryDecoder decoder(input);

encoder << std::uppercase << "Hello, world!";
std::string work;
output >> work;
std::cout << work;
std::cout << std::endl;

input << work;
while(decoder >> work)
std::cout << work;
std::cout << std::endl;

This will give the output:
48656c6c6f2c20776f726c6421
Hello,world!
Notice that the space is gone between "Hello," and "world!"
I tried to change the while loop such:
while(decoder >> std::noskipws >> work)
std::cout << work;
But this seems to regard the blank character as a terminator with this output:
48656c6c6f2c20776f726c6421
Hello,
throstur62
 
Posts: 11
Joined: 22 Nov 2012, 18:44

Re: Poco::HexBinaryDecoder allways removes blanks.

Postby alex » 15 Jul 2014, 03:54

that is standard istream behavior.
alex
 
Posts: 1130
Joined: 11 Jul 2006, 16:27
Location: United_States

Re: Poco::HexBinaryDecoder allways removes blanks.

Postby throstur62 » 15 Jul 2014, 12:37

Yes I'm aware of that. But it should be possible to override it with std::noskipws such:
Code: Select all
while(decoder >> std::noskipws >> work)
   std::cout << work;

But unfortunately that is not working, as I described in my original post.
Is that a bug in the Poco decoder class?
throstur62
 
Posts: 11
Joined: 22 Nov 2012, 18:44

Re: Poco::HexBinaryDecoder allways removes blanks.

Postby guenter » 15 Jul 2014, 13:13

No. skipws only applies to leading whitespace. See here for an explanation. Use unformatted operations like read() or get().
guenter
 
Posts: 1135
Joined: 11 Jul 2006, 16:27
Location: Austria


Return to Support

Who is online

Users browsing this forum: No registered users and 2 guests

cron