forked from glynos/cpp-netlib
-
Notifications
You must be signed in to change notification settings - Fork 425
Closed
Description
I don't know if this is an issue. Maybe i use it the wrong way but it seems to me that the encode_char(..) function in the encode.hpp file does not work with utf8 encoded strings at least here with clang++ 5.0 on mac os x.
I reallized that the line
out++ = hex_to_letter( in>>4 );
assumes that the left side is filled with zeros during the right shift which might not be the case for negative numbers ("implementation-defined"). Here it is filled with ones (the most significant bit). When i try to encode the "€" symbol with:
std::cout << uri::encoded(u8"€") << std::endl;
the result is:
%52%/2%1C
which should be
%E2%82%AC
To fix this i replaced the line in encode.hpp with
out++ = hex_to_letter( (in>>4) & 0x0f );
I use the current release (0.10.1).