DXF Unicode Decoder

The DXF format uses a special form of unicode encoding: “\U+xxxx”.

To avoid a speed penalty such encoded characters are not decoded automatically by the regular loading function:func:ezdxf.readfile, only the recover module does the decoding automatically, because this loading mode is already slow.

This kind of encoding is most likely used only in older DXF versions, because since DXF R2007 the whole DXF file is encoded in utf8 and a special unicode encoding is not necessary.

The ezdxf.has_dxf_unicode() and ezdxf.decode_dxf_unicode() are new support functions to decode unicode characters “\U+xxxx” manually.

ezdxf.has_dxf_unicode(s: str) bool

Detect if string s contains encoded DXF unicode characters “\U+xxxx”.

ezdxf.decode_dxf_unicode(s: str) str

Decode DXF unicode characters “\U+xxxx” in string s.


Some handy tool functions used internally by ezdxf. datetime) float float) datetime int, flag: int, state: bool = True) int

Set/clear binary flag in data flags.

  • flags – data value

  • flag – flag to set/clear

  • stateTrue for setting, False for clearing str

Returns a general unique ID, based on uuid.uuid4().

This function creates a GUID for the header variables $VERSIONGUID and $FINGERPRINTGUID, which matches the AutoCAD pattern {XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX}. bytes) str

Returns data bytes as plain hex string. str, leading: bool = False, trailing: bool = True)

Suppress trailing and/or leading 0 of string s.

  • s – data string

  • leading – suppress leading 0

  • trailing – suppress trailing 0 float, fix_upside_down=True) float

Normalizes text angle to the range from 0 to 360 degrees and fixes upside down text angles.

  • angle – text angle in degrees

  • fix_upside_down – rotate upside down text angle about 180 degree

SAT Format “Encryption” Iterable[str]) Iterable[str]

Encode the Standard ACIS Text (SAT) format by AutoCAD “encryption” algorithm. Iterable[str]) Iterable[str]

Decode the Standard ACIS Text (SAT) format “encrypted” by AutoCAD.