1

Topic: What type to use for a line?

For a long time did not write on With ++, and here it was required to write a component working both in Windows (32/64), and in Linux (34/64). Initially I planned to use type wstring, using wchar_t as the character, but came across many articles that wchar_t does not approach for  development and generally for Unicode. Yes, I in course that in VC and GCC the size of this type differ, but I always considered that wchar_t have been entered to abstract that one character is occupied with 1 byte and function wcslen returns the correct amount of characters if we admit one of them occupies 4 bytes instead of two. But then the index operator for type wstring should be forbidden, and it is resolved. It is necessary to adhere to what approach?
1. To hammer in that some characters can not be located in wchar_t (is not supposed that the component will be used in the countries with hieroglyphs)
2. To use new type char32_t and somewhere to search for implementation of standard functions for this type
3. To start to use ICU and its type UChar32

2

Re: What type to use for a line?

svcoder wrote:

came across many articles that wchar_t does not approach for  development and
Generally for Unicode.

Seriously you consider, what one million lemmings cannot be mistaken?.

3

Re: What type to use for a line?

svcoder;
Do not use the index operator, for code pages where charms happens> 2

4

Re: What type to use for a line?

In coding UTF-8 the problem misses

5

Re: What type to use for a line?

svcoder wrote:

For a long time did not write on With ++, and here it was required to write a component working both in Windows (32/64), and in Linux (34/64). Initially I planned to use type wstring, using wchar_t as the character, but came across many articles that wchar_t does not approach for  development and generally for Unicode.

All is a little equal on the contrary.
But articles such can be, and they are quite correct, and all problem that Shindoshs stopped with any  on UCS-16 (actually its compilers), and Linux  at once on UCS-32
If the Chinese and Japanese hieroglyphs that almost for certain you can live quite well and on wchar_t () are not necessary to you.
The approach necessary to you, anybody except you does not select, as only you know requirements to your software.
1. To hammer in that some characters can not be located in wchar_t
Well, a variant, and most simple and clear.

2. To use new type char32_t and somewhere to search for implementation of standard functions for this type

To search it is necessary nothing, enough to write one typedef on std:: basic_string <char32_t>
3. To start to use ICU and its type UChar32
Well, if the advanced functions of operation with the international text, only so are necessary.