Linked Questions
10 questions linked to/from Compare std::wstring and std::string
-2 votes
3 answers
3k views
how can I use L prefix to unquoted string? [duplicate]
Possible Duplicate: Compare std::wstring and std::string I have silly question. I know I can use L prefix before a string to use it as wchar_t* (for unicode strings) but I dont know how to use ...
39 votes
7 answers
57k views
How to convert UTF-8 std::string to UTF-16 std::wstring?
If I have a UTF-8 std::string how do I convert it to a UTF-16 std::wstring? Actually, I want to compare two Persian words.
73 votes
4 answers
16k views
WChars, Encodings, Standards and Portability
The following may not qualify as a SO question; if it is out of bounds, please feel free to tell me to go away. The question here is basically, "Do I understand the C standard correctly and is this ...
92 votes
1 answer
71k views
Unicode encoding for string literals in C++11
Following a related question, I'd like to ask about the new character and string literal types in C++11. It seems that we now have four sorts of characters and five sorts of string literals. The ...
3 votes
1 answer
18k views
How to convert string to wstring in C++
I have programmed some code but there is some problem. In this codes i am trying to convert string to wstring. But this string have "█" characters. This character have 219 ascii code. This conversion ...
2 votes
2 answers
3k views
ICU C++ Converting Encodings
As I understand it, different locales have different encodings. With ICU I'd like to convert from a UnicodeString to the current locale's encoding, and back. Specifically I'm using Boost's Filesystem ...
4 votes
2 answers
903 views
GNU Gettext and wide characters
I'm developing a game (actually I'm porting it from Gosu to SFML) in C++. I'm using GNU Gettext as the i18n system. As you know, gettext returns char * strings using the local encoding, usually UTF8. ...
2 votes
1 answer
1k views
How to make my `std::string url_encode_wstring(const std::wstring &input)` work on Linux?
So we have such function: std::string url_encode_wstring(const std::wstring &input) { std::string output; int cbNeeded = WideCharToMultiByte(CP_UTF8, 0, input.c_str(), -1, ...
1 vote
1 answer
234 views
Assert a BSTR with string
I have a test function as follow: [TestMethod] void RipMichaelJacksonTest() { string expected = "Hello"; BSTR actual = SysAllocString(L"Hello"); Assert::AreEqual(...
0 votes
1 answer
164 views
STL string conversion between wstring and string
I am wondering is this adequate enough to use in a production codebase? std::wstring s2w(const std::string& s) { std::wstring ws; ws.assign(s.begin(), s.end()); return ws; } std::...