vector buffer is fine ?
I want to set any language to buffer.
such as Arabic and English.
how set unicode to string .
for example:
std::string txt = " سلام hi "
socket.sendMessage(txt);
Arabic characters supported in UTF-16 not in UTF-8 and string is a typedef of basic_string<char> and it is takes only one byte . Instead , use std::u16string txt = u”وعليكم السلام”;
What type of string Is general for all language? if I want this " السلام hi "
I working on a message server And I need support all languages
main types to deal with unicode char -> for utf8 char16_t -> utf16 char32_t -> utf32 wchat_t -> it size maybe different ( 2 bytes or 4 byes ) use sizeof(wchat_t) i think all languages are supported utf16,utf32
thank you so much
you’re welcome
utf8 supports arabic
what is wrong with std::string in this case?
i know that you can encode any codepoints of UTF16 or UTF32 in UTF8 which will handle everything possible in unicode .
It will show error I think since string can’t hold one codepoints of multibytes ! but using auto txt = u8”arabic ع”; on windows i always prefer to use wchar_t which will handle arabic characters well, than just encoded it in utf8
I want store string to vector<char> for sending but char is 1 byte
for sending what?
wrong. you also have problem just at your output.
and those socket send recieve syscalls and related api functions also does not care about encoding they just are caring about bytes.
Обсуждают сегодня