'Unicode to integer conversion visual studio bug

Im trying to convert a unicode character to an integer and encountered a bug in visual studio not sure if its a bug or something im doing wrong

The project has unicode character set and not multibyte.

#include <windows.h>
#include <iostream>

int main()
{
    constexpr int a = L'🦀';

    printf("%i\n", a);
    std::cout << a << std::endl;

    return 0;
}

Problem: Mouse hovering variable 'a' shows that its 129408 or 0x1F980 which is correct but when it prints it out to the console i get 55358

I have created a new project and wrote the same code and it printed out the correct value but after switching the same project from unicode to multibyte and back to unicode it produces this issue, not sure how to fix this.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source