0

I have a web server developed in C++. In this web server, the data is received from the client side and stored in the database. Some of this data is in Persian, which is converted to Unicode UTF-8 format.
as example:

data string is "سلام" in client side
when i get data, in webserver
"D8%B3%D9%84%D8%A7%D9%85"

I want to convert UTF-8 Code to c++ string, How can I do this conversion?

2

1 Answer 1

3

Your string is not UTF-8 encoded but uses a custom encoding similiar to HTTP url query params.

% indicates that the next two characters encode a single byte in hex. You will need to parse for % and if you encounter such a character, interpret the next two characters as a hexadecimal encoded byte. Otherwise you just copy the characters/bytes over.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.