Problem
I have some resource files I've translated into a couple of languages and I noticed that some characters aren't being displayed correctly in my UI.
For example: Versión:
is displaying as Versión:
. I've ensured that I have the UNICODE
and _UNICODE
directives which, from everything I've read, should work as expected. What could be causing this?
Code
The code that's being called (and I did verify it's reaching this method):
static HINSTANCE _languageDll = NULL; //Setup in another function call
CString GetLangString(int resourceId)
{
CString langString;
langString.LoadString(_languageDll, resourceId);
return langString;
}
Inspecting langString
I can see it's loading Versión:
To see if it was a display issue I tried something similar to the following and it displayed correctly:
return CString("Versión:");
Looking through the code I noticed there's a define called LoadString
in WinUser.h which switches between LoadStringW
and LoadStringA
based on the UNICODE
directive. After some Google-fu I tried the following with no luck:
CString GetLangString(int resourceId)
{
WCHAR buffer[256];
LoadString(_languageDll, resourceId, buffer, sizeof(buffer)/sizeof(WCHAR));
return CString(buffer);
}
I didn't let it return, looking at the debugger I could see it again loaded Versión:
.
I'm at a total loss as to why this is happening. Could it be something with the resource files? I'm just diving into C++ so my skills could be better (AKA I'm a noob) so any help on this would be really appreciated.
Note: I'm taking over a project built by someone else so the reasoning behind why certain functionality is used is unknown to me.
Edit 1
The string in the original RC file is as follows:
STRINGTABLE
BEGIN
IDS_STRING703 "Version: %d.%d.%d.%d"
END
And in the translated RC file:
STRINGTABLE
BEGIN
IDS_STRING703 "Versión: %d.%d.%d.%d"
END