Thanks for your quick reply Alon. I compiled and ran this code on XCode and 
not Visual Studio. Are you running the code on Mac, Win or Linux? Perhaps, 
you can try adding the <cwctype> header into the code below? 

Sorry for the 'Hello, World!', I forgot to remove it from the generated 
sample project. I didn't print out the characters because the console might 
not display extended ASCII correctly. I inspected the values of smallE and 
bigE in the XCode and Chrome debugger.  é has a dec value of 233 while É 
will give 201.

Please let me know if you need more clarifications.

On Thursday, July 30, 2015 at 12:13:58 PM UTC+8, Alon Zakai wrote:
>
> Maybe I'm missing something, but the example program doesn't print 
> anything but "Hello, World!", and also, it doesn't build for me natively so 
> I can't compare the output (it gives an error on towupper not being 
> defined).
>
> On Wed, Jul 29, 2015 at 9:06 PM, awt <[email protected] <javascript:>> 
> wrote:
>
>> I tested this on sdk-1.30.0-64bit. I wrote a sample program below:
>>
>> #include <stdio.h>
>>
>> #include <string>
>>
>> #include <clocale>
>>
>>
>> using namespace std;
>>
>>
>> int main(int argc, const char * argv[])
>>
>> {
>>
>>
>>     // insert code here...
>>
>>     printf("Hello, World!\n");
>>
>>     
>>
>>     char* locale = setlocale(LC_ALL, NULL);
>>
>>     
>>
>>     wchar_t smallE = L'é';
>>
>>     
>>
>>     wchar_t bigE = towupper(smallE);
>>
>>     
>>
>>     return 0;
>>
>> }
>>
>>
>> I tested this on XCode and the result is the same as Visual Studio. I 
>> then ran the code against sdk 1.34.1 and emscripten-tag-1.34.3-64bit and 
>> both versions return the uppercase É which differs from both XCode and 
>> Visual Studio.
>>
>> On Thursday, July 30, 2015 at 2:43:13 AM UTC+8, Alon Zakai wrote:
>>>
>>> On which branch do you see the problem? On incoming (1.34.3) we now use 
>>> more musl code for locale stuff, so it might be different there.
>>>
>>>
>>> On Wed, Jul 29, 2015 at 6:36 AM, awt <[email protected]> wrote:
>>>
>>>> Hi,
>>>>
>>>> I was trying to convert the Latin small letter e with acute (é) into 
>>>> uppercase with the default 'C' locale using the following code:
>>>>
>>>> std::setlocale <http://en.cppreference.com/w/cpp/locale/setlocale>(LC_ALL 
>>>> <http://en.cppreference.com/w/cpp/locale/LC_categories>, "C");
>>>>
>>>> wchar_t upperChar = std::towupper(L'é')
>>>>
>>>>
>>>> Using Visual Studio, I get back the lowercase character é but with 
>>>> Emscripten, I get the uppercase É when I inspect the hex value of 
>>>> upperChar. This comes as a surprise to me because my understanding is that 
>>>> the default 'C' locale does not support extended ASCII so the Visual 
>>>> Studio behaviour seems to be correct for this case.  Is my understanding 
>>>> correct and how did Emscripten manage to do the uppercase conversion even 
>>>> though the locale is still the default 'C' locale? Thanks. 
>>>>
>>>>
>>>>  -- 
>>>> You received this message because you are subscribed to the Google 
>>>> Groups "emscripten-discuss" group.
>>>> To unsubscribe from this group and stop receiving emails from it, send 
>>>> an email to [email protected].
>>>> For more options, visit https://groups.google.com/d/optout.
>>>>
>>>
>>>
>

-- 
You received this message because you are subscribed to the Google Groups 
"emscripten-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to