Click here to Skip to main content
16,021,687 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: GUI Freezes randomly /MFC /C++ Pin
Zishan Ud78720-Sep-24 23:16
Zishan Ud78720-Sep-24 23:16 
AnswerRe: GUI Freezes randomly /MFC /C++ Pin
Dave Kreskowiak20-Sep-24 13:53
mveDave Kreskowiak20-Sep-24 13:53 
QuestionRe: GUI Freezes randomly /MFC /C++ Pin
David Crow23-Sep-24 2:05
David Crow23-Sep-24 2:05 
QuestionCharacter set Pin
Calin Negru12-Sep-24 23:03
Calin Negru12-Sep-24 23:03 
AnswerRe: Character set Pin
CPallini12-Sep-24 23:19
mveCPallini12-Sep-24 23:19 
GeneralRe: Character set Pin
Calin Negru12-Sep-24 23:46
Calin Negru12-Sep-24 23:46 
GeneralRe: Character set Pin
Mircea Neacsu13-Sep-24 0:06
Mircea Neacsu13-Sep-24 0:06 
GeneralRe: Character set Pin
trønderen13-Sep-24 9:33
trønderen13-Sep-24 9:33 
Mircea Neacsu wrote:
the most popular by far being UTF-8[^].
I'd say that the most popular file storage format is UTF-8.

As a working format, in RAM, UTF-16 is very common. E.g. it is the format used by all Windows APIs, which is more or less to say all Windows programs. Java uses UTF-16 in RAM, as do a lot of other modern languages.

It must be said that not all software that claims to use UTF-16 fully handles UTF-16 - only the BMP ("Basic Multilingual Plane"), so that all supported characters will fit in one 16-bit code unit. BMP didn't have space for latecomer alphabets, like for a number of African or Asian languages. Most developers said "But my program isn't aimed at such markets, so I'll ignore the UTF-16 surrogates, for handling such characters as two 16-bit code units. I can treat text as if all characters are of equal width, 16 bits".

But a new situation has arisen: Emojis have procreated to a number far exceeding the number of WinDings. They do not all fit in BMP, so a number of them have been allocated in other planes than BMP. Don't expect the end user to know which emojis are defined in which planes and refrain from using non-BMP emojis! If you are not prepared for them, your code may mess up the text badly.

Writing your own complete UTF-16 interpreter is not recommended. Use library functions! There is more to UTF-16 than just alternative planes: Some character codes are nonspacing, or combining (typically an accent and a character). So you cannot deduce the number of print positions from the length of the UTF-16 string - not even after considering control characters.

For "trivial" strings limited to Western alphabets, there usually is a fairly close correspondence between the number of UTF-16 code units and the number of positions. You can pretend that it is exact, but look out for cases that need to be treated as exceptions. I suspect that is what a lot of programmers do. 99,9% of Western text is free of exceptional cases, so the fixed-code-width assumption holds. Until, of course, emojis become common e.g. in file names. Note that UTF-32 does not provide an ultimate solution to all problems: You still may have to relate to nonspacing or combining characters!
Religious freedom is the freedom to say that two plus two make five.

GeneralRe: Character set Pin
Mircea Neacsu13-Sep-24 17:17
Mircea Neacsu13-Sep-24 17:17 
GeneralRe: Character set Pin
trønderen14-Sep-24 7:25
trønderen14-Sep-24 7:25 
GeneralRe: Character set Pin
Mircea Neacsu14-Sep-24 15:10
Mircea Neacsu14-Sep-24 15:10 
GeneralRe: Character set Pin
trønderen14-Sep-24 17:27
trønderen14-Sep-24 17:27 
GeneralRe: Character set Pin
Mircea Neacsu15-Sep-24 2:26
Mircea Neacsu15-Sep-24 2:26 
GeneralRe: Character set Pin
trønderen15-Sep-24 12:16
trønderen15-Sep-24 12:16 
GeneralRe: Character set Pin
Richard MacCutchan15-Sep-24 21:08
mveRichard MacCutchan15-Sep-24 21:08 
GeneralRe: Character set Pin
Mircea Neacsu16-Sep-24 2:41
Mircea Neacsu16-Sep-24 2:41 
GeneralRe: Character set Pin
jschell17-Sep-24 12:29
jschell17-Sep-24 12:29 
GeneralRe: Character set Pin
Richard MacCutchan14-Sep-24 21:34
mveRichard MacCutchan14-Sep-24 21:34 
GeneralRe: Character set Pin
Mircea Neacsu15-Sep-24 2:45
Mircea Neacsu15-Sep-24 2:45 
GeneralRe: Character set Pin
Richard MacCutchan15-Sep-24 2:58
mveRichard MacCutchan15-Sep-24 2:58 
GeneralRe: Character set Pin
trønderen15-Sep-24 12:19
trønderen15-Sep-24 12:19 
GeneralRe: Character set Pin
Mircea Neacsu17-Sep-24 13:49
Mircea Neacsu17-Sep-24 13:49 
GeneralRe: Character set Pin
jschell17-Sep-24 12:22
jschell17-Sep-24 12:22 
GeneralRe: Character set Pin
CPallini13-Sep-24 0:06
mveCPallini13-Sep-24 0:06 
GeneralRe: Character set Pin
Calin Negru13-Sep-24 1:32
Calin Negru13-Sep-24 1:32 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.