TIL that GS1, the de facto standards body for retail barcodes that is used for basically all contexts now, has a section on how to encode “Biological Sex” on a barcode, but not a section for encoding “Gender”. This refers to an ISO/IEC standard codification for “human sexes”.
This is recommended for use in heathcare contexts to identify patients.
Source: https://ref.gs1.org/standards/genspecs/ page 260