einstein1969 wrote:Unfortunately I can not understand the logic that there is' behind the "dos IF"
I'm not sure what you are meaning.
If you want to know why the characters are put in this order wee see here, than i only have to speculate, as i don't know it.
One reason my be, that MS has created an order for all glyphes that may be used by the dos shell with no dependencies to any other resource, so there is no inner logic behind that order (i doubt that, but it could be).
Another reason might be hidden in the character representation.
A character is just a semantic definition, for example: "undersore".
To simplify their usage, to each character a codepoint is assigned uniquely, for example: codepoint ("underscore") = 0x5F.
As this is a bijective mapping, you also could say it the other way around: character (0x5F) = "underscore".
An set of such assignments is called a character code/character set/character mapping/..., for example: ASCII.
Example:
ASCII: {0x00 : 0x7F} --> { ..., "underscore", ... }
..., ASCII (0x5F) := "underscore", ...
But with this definitions you can't see anything. You need some graphics called glyphs, that you may use, if you want to display a character.
A set of glyphs is a font. They are stored in a font file, but as a font is not forced to define all glyphs for all characters they have an index number and a codepoint number, for example glyph_and_codepoint_of_font[0] := (graphic of (_), 0x0F).
Such a mapping is called a codepage. But this name is also in use for:
- a mapping from each codepoint to a glyph index, and
- a mapping from each codepoint to a glyph.
This has historical reasons, as the glyphs were stored in RAM or in BIOS ROM/RAM basing on the system, and just was replaced if the codepage was changed.
As Windows started using Unicode for the character representation, they stepwise changed this definition, and i assume they also changed the implementation of the chcp executable.
So nowadays, everytime a DOS shell reads byte value for character representation, it does something like this:
- interprets this byte as an ANSI codepoint
- parses this ANSI codepoint to a Unicode codepoint
- performs the Unicode codepoint using the actual codepage so it gets a fonts glyph index
- finally it renders the glyph at this glyph index
Back to the character order that IF is using:
The shell may use any number to define the used order (ANSI codepoint, Unicode codepoint, glyph index).
It also could use the indices of the transformations itself, for example:
The index of the assignment [ASCII (0x5F) := "underscore"] that could be any number in [0x00 : 0x7F], and may not be identical with the codepoint, similar to glyph indices.
It also could be any transformed of the above, for example:
Lets assume, that the assignment of [ASCII (0x5F) := "underscore"] is 0x04.
Then the ordering key may be the value 0x5F04.
I myself assume that the dos shell uses the indices of the glyphs to order the characters, but i can't proof it.
But a hint is that on different machines, where the fonts may be rebuild for performance reasons; so other indices are used to order the characters.
But this hint may also be true for many other character orders.
penpen