Skip to content

URI encode_char()  #362

@dqpb

Description

@dqpb

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).

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions