|
-
Jan 10th, 2006, 06:03 AM
#1
Thread Starter
Hyperactive Member
ASCII vs UNICODE
How do I ensure that the characters that I am using are in either UNICODE or ASCII?
e.g.
is
Code:
const char* aString = "hello";
going to be stored in ASCII or UNICODE?
Thanks!
-
Jan 10th, 2006, 06:21 AM
#2
Re: ASCII vs UNICODE
"hello" is always an ASCII string, L"hello" is always a Unicode string. If you want a program that works in both Unicode and ASCII builds you should use something like:
Code:
#ifdef UNICODE
#define _T(X) L ## X
#else
#define _T(X) X
#endif
_T("my string") // becomes L"my string" in unicode builds
-
Jan 10th, 2006, 07:08 AM
#3
Re: ASCII vs UNICODE
Actually, "hello" is always in the implementation's native character set (Windows-1252 for VC++, ISO-8859-1 (known as Latin-1) for GCC on x86, but for example EBCDIC for some old IBM-based imlementations, which is not a superset of ASCII), while L"hello" is always in the implementation's wide character set (UTF-16 for both GCC and VC++, I think, though it might be UCS-2 or even UCS-4 for some compilers).
All the buzzt
 CornedBee
"Writing specifications is like writing a novel. Writing code is like writing poetry."
- Anonymous, published by Raymond Chen
Don't PM me with your problems, I scan most of the forums daily. If you do PM me, I will not answer your question.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|