[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Byte order in the GNU mo file format
From: |
Vivien Kraus |
Subject: |
Byte order in the GNU mo file format |
Date: |
Sat, 21 Dec 2024 15:41:47 +0100 |
User-agent: |
Evolution 3.48.4 |
Dear Gettext developers,
The MO file format specification reads:
“The magic number will always signal GNU MO files. The number is stored
in the byte order used when the MO file was generated, so the magic
number really is two numbers: 0x950412de and 0xde120495.”
It then goes on to specify the rest of the file format, with a lot of
4-byte numbers (offsets and string lengths).
At the bottom of the page, a figure gives the canonical value
0x950412de as the magic number (and not the other one).
In order to parse MO files, my interpretation is that I should look at
the 4-byte magic cookie. If it is [de 12 04 95], then I should read
every 4-byte number (offset or string length) as little-endian, and if
it is [95 04 12 de], then I should read every 4-byte number as big-
endian.
Do I understand this correctly?
Best regards,
Vivien Kraus
- Byte order in the GNU mo file format,
Vivien Kraus <=