Coding a path in unicode c++
<p>I had a problem with opening UTF-8 path files. Path that has a UTF-8 char (like Cyrillic or Latin). I found a way  to solve that with <code>_wfopen</code> but the way a solved it was when I encode the UTF-8 char with UTF by hand (\Uxxxx).</p>

<p>Is there a function, macro or anything that when I supply the string (path) it will return the Unicode??</p>

<p>Something like this: 
<a href="https://www.branah.com/unicode-converter" rel="nofollow">https://www.branah.com/unicode-converter</a></p>

<p>I tried with <code>MultiByteToWideChar</code> but it returns some Hex numbers that are not relavent.</p>

<p>Tried:</p>

<pre><code>std::wstring s2ws(const std::string&amp; s)
{
    int len;
    int slength = (int)s.length() + 1;
    len = MultiByteToWideChar(CP_ACP, 0, s.c_str(), slength, 0, 0);
    wchar_t* buf = new wchar_t[len];
    MultiByteToWideChar(CP_ACP, 0, s.c_str(), slength, buf, len);
    std::wstring r(buf);
    delete[] buf;
    return r;
}
std::wstring stemp = s2ws(x);
LPCWSTR result = stemp.c_str();
</code></pre>

<p>The result I get: <code>0055F7E8</code></p>

<p>Thank you in advance</p>

<h1>Update:</h1>

<p>I installed boost, and now I am trying to do it with boost. Can some one maybe help me out with boost.</p>

<p>So I have a path:
<code>wchar_t path[100] = _T("čaćšžđ\\test.txt");</code></p>

<p>I need it converted to:</p>

<p><code>wchar_t s[100] = _T("\u010d\u0061\u0107\u0161\u017e\u0111\\test.txt");</code></p>