What is the string encoding used for `FLOAT_EXT` in the Erlang term format?

In the documentation for the External Term Format, FLOAT_EXT is described as:

A finite float (i.e. not inf, -inf or NaN) is stored in string format. The format used in sprintf to format the float is “%.20e” (there are more bytes allocated than necessary). To unpack the float, use sscanf with format “%lf”.

What is the string encoding used to encode the string? Is it ASCII? Latin-1? UTF-8? I am guessing that maybe it doesn’t matter since the string should only consist of numbers, ., +, and e, and I further assume these characters have the same byte representation across ASCII, Latin-1, and UTF-8 (that is an assumption and guess, I haven’t checked it). But does anyone know?

1 Like

Yes, you are correct. I doesn’t matter.

Furthermore, as the documentation says, FLOAT_EXT has been superseded by NEW_FLOAT_EXT.


Thank you @bjorng! I will just use ASCII to do the decoding in this case.

And yes, I saw the note that NEW_FLOAT_EXT superseded it. However, I am writing an encoding/decoding library for the Erlang term format in another language, and I was trying to support as much of the tags/forms as possible, at least for decoding.