wchar_t


 
Thread Tools Search this Thread
Top Forums Programming wchar_t
# 1  
Old 03-19-2010
wchar_t

1. Can anybody tell me why this outputs: Ros? (My locale is: en_US.UTF-8 and I'm using gcc)
2. I need wchar_t if I want to use chars with accents ?
3. Can I use UTF-8 with wchar_t ?

Code:
#include <stdio.h>
#include <wchar.h>

int main(void)
{
    wchar_t VAR[10]= L"Rosé";

        wprintf(VAR); // Ros?

        return 0;
}

# 2  
Old 03-20-2010
UTF-8 and wchar_t are mutually exclusive. If your terminal supports unicode you should be able to use unicode in ordinary strings(technically an accidental feature, but gcc at least should tolerate this) though will have to be aware that one byte is no longer necessarily one character.

Make sure your text editor is also UTF-8.
Login or Register to Ask a Question

Previous Thread | Next Thread

1 More Discussions You Might Find Interesting

1. Programming

_fopen with wchar_t*

how can I use function _fopen(char* , char*) if name of the file with wide char symbols? (0 Replies)
Discussion started by: nickppv2000
0 Replies
Login or Register to Ask a Question