The UDUNITS-2 package differs from the previous UDUNITS package in the
following ways:
Support for non-ASCII characters. The original UDUNITS package only
supports the ASCII character set. The UDUNITS-2 package supports
the following character sets: ASCII, ISO 8859-1 (Latin 1), and the
UTF-8 encoding of ISO 10646 (Unicode). This means that unit string
specifications like "µ°F·Ω⁻¹" are now supported (your viewer
must support UTF-8 to display this string correctly).
Support for logarithmic units. The unit string specification
"0.1 lg(re 1 mW)" specifies a deciBel unit with a one milliwatt
reference level. Meteorologists should note that the unit "dBZ"
(i.e., "0.1 lg(re um^3)") is now supported.
Persistent value converters. It is now possible to obtain a converter
data-object, which can be used to convert numeric values in one
unit to numeric values in another, compatible unit. The values can
be float, double, or one-dimensional arrays of floats or doubles.
Improved API. Due to the above changes, it was not possible to keep
the application programming interface of the original UDUNITS
package. Beginning with version 2.1.0, however, the package
contains a thin UDUNITS API to the UDUNITS-2 library, so code
written to the original API can simply be recompiled and relinked
against the new package. Because the original UDUNITS API uses the
"utUnit" data-structure and the UDUNITS-2 API uses pointers to
"ut_unit" data-structures, a small memory-leak is possible in code
that creates many units. This leak can be avoided by calling the
new method utFree(utUnit*) when the unit is no longer needed.
XML unit database. The unit database is encoded using human-readable
XML rather than a custom format. The XML parser included in the
package supports an <import> element to allow easy and convenient
customization.
One thing that has not changed is that all unit string specifications
understood by the original UDUNITS package are also understood by the
new UDUNITS-2 package.