openOMSI GitHub Discord

Docs / Reference / Content formats

Text encoding

1 min readEdit this pagedocs/FORMATS.md

  • Map files (global.cfg, tile_x_y.map, Chrono *.map, *.chronoterrrelevant) are UTF-16LE with BOM (FF FE).
  • Every other text file is read by OMSI in the system's ANSI code page (Delphi AnsiString): the stock content is Windows-1252, but a mod is written in its author's code page - Windows-1251 for the Russian ones (LiAZ, PAZ, the Scania Citywide's cockpit), 1250 for the Polish and Czech ones - and some newer files are UTF-8. openOMSI has no system code page to borrow and decides per file (omsi-cfg::codepage::detect): valid UTF-8;

    1251 when at least half of the letters 0xC0.. stand in runs of three or more (Russian words; German has at most two in a row, "Größe"); 1250 when letters that are signs in 1252 (ł ą ś Ł Ś Ż) stand next to letters; 1252 otherwise.

    A font may still have been read in another code page than the text it shows, so a glyph is also looked up as the same byte in 1251/1250/1252.

  • File names beyond ASCII may have picked up another spelling on the way: a zip stores a name without its UTF-8 flag in the OEM code page of the machine that made it (CP866 on a Russian one) and the unpacker guesses another (the Scania's верх.png arrived as óąÓň.png, CP866 read as CP852).

    A name is also looked for as its bytes in CP437, CP852, 1252 or 1250 read again in CP866, 1251, 1250 or 1252 (codepage::name_variants).

  • Line endings are CR LF. Numbers use . as decimal separator and may carry an exponent (6.21874087223886E-7).

Something wrong or missing? Fix it on GitHub or open an issue.

↑↓ to move↵ to open