![]() |
|
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
Hobbyist Programmer
|
Wide characters
Hi,
I was just wondering what the heck a wide character was? I've never needed to use one.... Thanks very much, Matt. I |
|
|
|
|
|
#2 |
|
Programming Guru
![]() ![]() |
Re: Wide characters
Wikipedia is your friend: Wide Characters.
Essentially, it is a datatype used to store any character that could not otherwise be stored with the regular "char" datatype. This is because the number of bits used to distinguish a wide character from other characters exceeds the number of bits that a normal character datatype can store. The specifics of this are beyond me. |
|
|
|
|
|
#3 |
|
PFO God In Training
![]() Join Date: Jun 2005
Location: near St Louis, MO. (USA)
Posts: 598
Rep Power: 4
![]() |
Re: Wide characters
wide characters are used in UNICODE programs, which are programs written for most any language such as Chinese, Japanese, German, Frensh, etc. etc. Many characters in non-English languages can't be represented in one char data type. There is actually a UNICODE standard which specify the width of a UNICODE character and functions to manipulate them, and convert from char* to wchar_t*. The Microsoft compilers have a large set of macros to convert function calls between UNICODE and non-UNICODE compiles. If you use these macros you can compile with or without UNICODE with nearly no changes in the source code.
|
|
|
|
|
|
#4 |
|
Hobbyist Programmer
|
Re: Wide characters
Brilliant! Thank you very much for your help!
|
|
|
|
|
|
#5 |
|
Newbie
Join Date: Dec 2007
Posts: 14
Rep Power: 0
![]() |
Re: Wide characters
Also its consider better to use wide characters than ansi characters. The reason why is that behind the scenes, the compiler has to convert from unicode to ansi each time. Which causes a performance hit. So when you build applications always you unicode to be safe from the performance hit on non-unicode apps
![]() |
|
|
|
|
|
#6 |
|
PFO God In Training
![]() Join Date: Jun 2005
Location: near St Louis, MO. (USA)
Posts: 598
Rep Power: 4
![]() |
Re: Wide characters
>>The reason why is that behind the scenes, the compiler has to convert from unicode to ansi each time
No it does not do that, unless you are using some wierd compiler which does that on its own. The compiler uses UNICODE wide characters only if you define UNICODE in your program. Otherwise it uses standard char ascii character set. >>So when you build applications always you unicode to be safe from the performance hit on non-unicode apps Maybe what you mean is that the operating system makes that conversion. I don't know whether that is true or not because I don't know the internals of the MS-Windows operating systems. |
|
|
|
|
|
#7 | |
|
Newbie
Join Date: Dec 2007
Posts: 14
Rep Power: 0
![]() |
Re: Wide characters
Quote:
look for single built ansi |
|
|
|
|
|
|
#8 |
|
PFO God In Training
![]() Join Date: Jun 2005
Location: near St Louis, MO. (USA)
Posts: 598
Rep Power: 4
![]() |
Re: Wide characters
I believe that is talking about the operating system, not the compiler. Yes, all versions of WinCE and Mobile 5.0 systems are pure (almost) UNICODE, that is, most of the windows api functions and classes required UNICODE. The compiler for those operating systems still support ascii characters just as any other standard c++ compiler does. I worked with these for 10 years. Windows NT thru Vista support UNICODE but do not require it. In order to display a character on the screen the os probably does convert it to unicode, but the compiler has nothing to do with that.
As for COM, it doesn't require UNICODE either, it can transfer ascii characters just as easily as UNICODE (or bstr). And a bstr can be either unicode or ascii, depending on how the program wants to interpret it. Last edited by Ancient Dragon; Dec 4th, 2007 at 10:20 PM. |
|
|
|
![]() |
| Bookmarks |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| PHP Regular Expression: Matching All Possible Characters | kruptof | PHP | 3 | May 30th, 2007 7:22 PM |
| Replacing characters in std::string | magnus.therning | C++ | 10 | Feb 1st, 2007 10:11 AM |
| 2 dimension array of characters | brad sue | C | 8 | Mar 15th, 2006 10:40 AM |
| Converting ANSI characters to hex for Checksum. | JawaKing00 | C | 4 | Sep 9th, 2005 6:07 AM |