Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

Already on GitHub? Sign in to your account

Wrong Codepage in w2a (src/Utility.cpp) because German letters are not translated correctly in error messages #133

Open
karlw4 opened this Issue Jun 3, 2013 · 3 comments

Comments

Projects
None yet
2 participants

karlw4 commented Jun 3, 2013

Hi,
I have an issue with error messages from ''RAISERROR'' because they are sent as UCS2 but on client side translated to ANSI (CP_ACP). If I change the first parameter of ::WideCharToMultiByte to CP_UTF8 (2 times) then all error messages are translated correctly.
You can test this with the sql statement

RAISERROR('größer', 16, 1)

complete source of w2a:

string w2a(const wchar_t* input)
{
    vector<char> messageBuffer;
    int length = ::WideCharToMultiByte(CP_UTF8, 0, input, -1, nullptr, 0, nullptr, nullptr);
    if (length > 0)
    {
        // length includes null terminator
        messageBuffer.resize(length);
        ::WideCharToMultiByte(CP_UTF8, 0, input, -1, messageBuffer.data(), messageBuffer.size(), nullptr, nullptr);
    }
    return string(messageBuffer.data());
}
Contributor

jkint commented Jun 4, 2013

Thanks for this! I can fix it myself, but that will take a while. Or, you could complete a CLA and submit a pull request with this change. Unfortunately I wish I could say that it wouldn't take that long either, but it would probably be sooner than waiting for me to fix it.

Again, thanks for this.

karlw4 commented Jun 5, 2013

I have compiled the sources on my machine and it works fine for me. I have already forked the source and commited the changes but it was a pain for me. I am new to git and it makes me crying! I love tortoisehg...
So I will look for this CLA and will send it to you.

karlw4 commented Jun 5, 2013

I had also troubles at compiling the sources because it says that I have the wrong C++ version. I had to disable this warnigns in
c:\Program Files(x86)\MSBuild\Microsoft.Cpp\v4.0\V110\Microsoft.Cpp.Platform.targets
to compile successfully.
I have installed Visual Studio 2012 Professional but compiled with nodegyp. I read about changes in source code to make the things work a few months ago but for me it didn't work.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment