Examples: Version 1 LDIF

 

Here is an example of an LDIF file useing the optional charset tag.

You can use the optional charset tag so that the utilities will automatically convert from the specified character set to UTF-8 as in the following example:

 version: 1
 charset: ISO-8859-1

 dn: cn=Juan Griego, o=University of New Mexico, c=US  cn: Juan Griego  sn: Griego  description:: V2hhdCBhIGNhcmVmdWwgcmVhZGVyIHlvd  title: Associate Dean  title: [title in Spanish]
 jpegPhoto:> file:///usr/local/photos/jgriego.jpg

In this instance, all values following an attribute name and a single colon are translated from the ISO-8859-1 character set to UTF-8. Values following an attribute name and a double colon (such as description:: V2hhdCBhIGNhcm... ) must be base-64 encoded, and are expected to be either binary or UTF-8 character strings. Values read from a file, such as the jpegPhoto attribute specified by the Web address in the previous example, are also expected to be either binary or UTF-8. No translation from the specified "charset" to UTF-8 is done on those values.

In this example of an LDIF file without the charset tag, content is expected to be in UTF-8, or base-64 encoded UTF-8, or base-64 encoded binary data:

# IBM Directorysample LDIF file  #
 # The suffix "o=IBM, c=US" should be defined before attempting to load  # this data.

 version: 1

 dn: o=IBM, c=US  objectclass: top  objectclass: organization  o: IBM 
 dn: ou=Austin, o=IBM, c=US  ou: Austin  objectclass: organizationalUnit  seealso: cn=Linda Carlesberg, ou=Austin, o=IBM, c=US

This same file could be used without the version: 1 header information, as in previous releases of the IBM Directory:

 # IBM Directorysample LDIF file  #
 # The suffix "o=IBM, c=US" should be defined before attempting to load  # this data.

 dn: o=IBM, c=US  objectclass: top  objectclass: organization  o: IBM 
 dn: ou=Austin, o=IBM, c=US  ou: Austin  objectclass: organizationalUnit  seealso: cn=Linda Carlesberg, ou=Austin, o=IBM, c=US

The textual attribute values can be specified in base-64 format.

 

Parent topic:

LDAP data interchange format (LDIF)