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.

New in version 0.14.

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.

ezdxf.int2rgb(value: int) → Tuple[int, int, int]

Split RGB integer value into (r, g, b) tuple.

ezdxf.rgb2int(rgb: Tuple[int, int, int]) → int

Combined integer value from (r, g, b) tuple.

ezdxf.float2transparency(value: float) → int

Returns DXF transparency value as integer in the range from 0 to 255, where 0 is 100% transparent and 255 is opaque.


value – transparency value as float in the range from 0 to 1, where 0 is opaque and 1 is 100% transparency.

ezdxf.transparency2float(value: int) → float

Returns transparency value as float from 0 to 1, 0 for no transparency (opaque) and 1 for 100% transparency.


value – DXF integer transparency value, 0 for 100% transparency and 255 for opaque datetime.datetime) → float float) → datetime.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.uuid1(). 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 int) → Tuple[int, int, int]

Convert AutoCAD Color Index (ACI) into (r, g, b) tuple, based on default AutoCAD colors. 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.