This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug libstdc++/79511] Convertation issues in std::codecvt_utf8_utf16


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=79511

--- Comment #9 from ww898 <mikhail at pilin dot name> ---
#include <iostream>
#include <codecvt>
#include <string>
#include <iomanip>

int main()
{
    static char const src[] = "\xE2\x82\xAC";
    std::wstring_convert<std::codecvt_utf8_utf16<wchar_t>> conv;
    auto const dst = conv.from_bytes(src);
    std::cout << std::hex << std::setw(4) << std::setfill('0') << (unsigned)
dst[0] << std::endl;
}

Output:
 MSVC:  0x20ac
 Clang: 0x20ac
 GCC:   0xac20

P.S. http://rextester.com/PRPX46172

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]