c++ - Do we need to consider encoding (UTF-8) while constructing a string from char* buffer -


i working on http client module receives information server in character buffer , utf-8 encoded. wanted create std::string object character buffer.

can create string object directly passing character buffer ?

 std::string receivedstring(receievedbuffer,bufferlength); 

here receievedbuffer char[] array contains data received tcp/ip connection , bufferlength contains number of bytes received. confused term utf-8 , understood unicode encoding , need take steps before conversion.

std::string receivedstring(receievedbuffer,bufferlength); 

it not conversion, copies receievedbuffer receivedstring.

if receievedbuffer utf-8 encoded the exact same bytes stored receivedstring.

std::string storage format , not reflect encoding of data stored in it.


Comments

Popular posts from this blog

c++ - OpenMP unpredictable overhead -

ruby on rails - RuntimeError: Circular dependency detected while autoloading constant - ActiveAdmin.register Role -

javascript - Wordpress slider, not displayed 100% width -