negative values for char
-
Thanks for the reply. The whole application is developed around ANSI and changing everyting looks like not such a good idea. I was wandering if there is any mechanism to determine the “real character” behind -50. If I know that the real character is a greek character I can convert it into a html entity for example and I can get something like %u03C.
-
I dont know you checked my post or not...but this will work..isnt it? CString cstext = L"03C5"; wchar_t Greek; int nChar; swscanf( cstext, L"%x", &nChar ); Greek = nChar;
nave
-
I dont know you checked my post or not...but this will work..isnt it? CString cstext = L"03C5"; wchar_t Greek; int nChar; swscanf( cstext, L"%x", &nChar ); Greek = nChar;
nave
Naveen R wrote:
CString cstext = L"03C5";
naveen, be careful, write this :
CStringW cstext = L"03C5";
or
CString cstext = _T("03C5");
but don't mix the two styles. apparently, you're using wide characters in all the rest of your code, so i'd say use the former...
[VisualCalc][Flags Beginner's Guide] | [Forums Guidelines][My Best Advice]
-
I did . Thanks. I do not use CString (not using MFC). Your solution works but I am trying to find a way to determine if there is a possible to find our which Greek character is assigned to -50 (if there is such a possibility).
-
Naveen R wrote:
CString cstext = L"03C5";
naveen, be careful, write this :
CStringW cstext = L"03C5";
or
CString cstext = _T("03C5");
but don't mix the two styles. apparently, you're using wide characters in all the rest of your code, so i'd say use the former...
[VisualCalc][Flags Beginner's Guide] | [Forums Guidelines][My Best Advice]
-
but CString have both constructors CString(LPCWSTR lpsz) CString(LPCSTR lpsz) Any way I did so because he said( in his previous post) his project is UNICODE define...
nave
Naveen R wrote:
but CString have both constructors
this is not acceptable argument, because, if the application is not defining UNICODE macro, even if you initialize your CString with a LPCWSTR, the string will be casted into ANSI string. BTW, i doubt of this information. actually, CString gets a LPCTSTR, which is transformed into LPCSTR or LPCWSTR depending on unicode definition
Naveen R wrote:
Any way I did so because he said( in his previous post) his project is UNICODE define...
yes, but then prefer using CStringW. imagine the case when someone else has to maintain the application, or develop the dual possibility of having the application running both ansi and unicode... your code must be flexible, not only "aware"
[VisualCalc][Flags Beginner's Guide] | [Forums Guidelines][My Best Advice]
-
I did . Thanks. I do not use CString (not using MFC). Your solution works but I am trying to find a way to determine if there is a possible to find our which Greek character is assigned to -50 (if there is such a possibility).
micutzu wrote:
but I am trying to find a way to determine if there is a possible to find our which Greek character is assigned to -50 (if there is such a possibility).
That entirely depends on the text encoding. Which charset is the webpage you are working with? If it is Windows CP 1253 (Greek), you can find out by setting the codepage of your console window to 1253 and then printing it out. For -50 (ie 206 in unsigned form) it should be greek capital XI: Ξ
-
Naveen R wrote:
but CString have both constructors
this is not acceptable argument, because, if the application is not defining UNICODE macro, even if you initialize your CString with a LPCWSTR, the string will be casted into ANSI string. BTW, i doubt of this information. actually, CString gets a LPCTSTR, which is transformed into LPCSTR or LPCWSTR depending on unicode definition
Naveen R wrote:
Any way I did so because he said( in his previous post) his project is UNICODE define...
yes, but then prefer using CStringW. imagine the case when someone else has to maintain the application, or develop the dual possibility of having the application running both ansi and unicode... your code must be flexible, not only "aware"
[VisualCalc][Flags Beginner's Guide] | [Forums Guidelines][My Best Advice]
toxcct wrote:
if the application is not defining UNICODE macro, even if you initialize your CString with a LPCWSTR, the string will be casted into ANSI string.
Even if UNICODE is defined, I am expecting only ANSI characters in that statement.
toxcct wrote:
yes, but then prefer using CStringW
Whats is this CStringW? I didnt find any such class in vc6. I havent worked in later verions of visual studio. Is it a new class added to the MFC in later verions of visual studio?
nave
-
I did. printf("%c\n", c); wprintf( L"%c", c ); Both print the same character which is not the correct one ┼ (this is printed instead of Π)