notes/dif
2021-08-27 17:49:39 -04:00
..
byte.dif dif encoding 2021-08-24 01:29:28 -04:00
README.md dif Excel Number stored as Text inconsistency 2021-08-27 17:49:39 -04:00

Data Interchange Format

Files starting with TABLE followed by a newline marker followed by 0,1 should be interpreted as DIF.

There exists a technical specification from 1983.

Encoding

The specification includes a Pascal procedure for reading a string. There is an error in handling double quotes:

      if str[1] = '"'                            { strip quotes }
         then begin
                delete (str, 1, 1);
                delete (str, pos('"', str), length(str) - pos('"', str) + 1)
              end

It does not correctly handle " characters in strings. Writers should use "" (similar to CSV encoding). The following DIF snippet represents ":

1,0
""""

Excel Number stored as Text inconsistency

Even if a data point is marked as text, Excel will try to interpret as Number. For example, the following DIF snippet should represent the text "0.3":

1,0
"0.3"

Excel ignores the type and interprets the cell as the number 0.3. To force a textual interpretation, the formula trick (same as CSV) works:

1,0
"=""0.3"""

Analytics