Visual-Studio 2013 changes my wstring

118 views Asked by At

I have the following code:

bool IsCharVowel(const wstring uChar)
{
    if (Has(L"aeiouäöüúéáàèùò",uChar))
    {
        return true;
    }
    else
    {
        return false;
    }
}

bool Has(wstring uSearchIn, wstring uSearchFor)
{

    if (uSearchFor.size()==0)
    {
        return false;
    }

    if (uSearchIn.find(uSearchFor)!=wstring::npos)
        return true;
    else
        return false;
}

As soon as I inspect the passed wstring in the function "Has", the wstring is different from what I have entered:

uSearchIn = L"aeiouäöüúéáàèùò"

Does anybody see what is going wrong here?

1

There are 1 answers

1
tmighty On

I got it!!

I changed the encoding of the .cpp file to "UTF-8 (no signature)"

I have now switched it to "UTF-8 (with signature)".

Now it works as expected.