Menu

Reading LDIF with special characters

2014-01-30
2014-01-31
  • Oscar Golden L.

    Oscar Golden L. - 2014-01-30

    hi,
    I am trying to read an LDIF file that contains a "+" sign in one of the entry and I am getting an exception. Removing the "+" sign removes the exception

    The problematic entry in the LDIF is the following entry:

    ~~~~~~~~~~~~~
    dn: extId=tel:+1234,dc=extId,ou=identities,o=Db,dc=o,dc=com
    objectClass: top
    objectClass: alias
    objectClass: extId
    extId: tel:+1234
    aliasedObjectName: assocId=sip:bob@abc.com,DbId=abc.com,ou=DbData,o=Db,dc=o,dc=com
    ~~~~~~~~~~~~~~

    I am reading with the following :

    LDIFReader example_reader = new LDIFReader(simulator.class.getResourceAsStream("example.ldif"));
    server.importFromLDIF(false, example_reader);
    

    I tried to escape the "+" sign in different ways but no luck.
    Any pointer would be appreciated.

    Thank you.

     
  • Neil Wilson

    Neil Wilson - 2014-01-31

    In LDAP DNs, the plus sign is used to indicate that an RDN has multiple attribute-value pairs (e.g., the DN "givenName=John+sn=Doe,ou=People,dc=example,dc=com" includes both "givenName=John" and "sn=Doe" as values of the RDN).

    If you have a plus sign in an RDN value, then you need to escape it by prefixing it with a backslash. In your case, that would be "extId=tel:+1234,dc=extId,ou=identities,o=Db,dc=o,dc=com".

     
    • Oscar Golden L.

      Oscar Golden L. - 2014-01-31

      Did you mean tel:\+1234 ?

      "extId=tel:\+1234,dc=extId,ou=identities,o=Db,dc=o,dc=com"
      

      Geez ... it works now ! Sorry about that. I am quite sure I tried it a couple times though.
      Anyways, thanks.

       
  • Neil Wilson

    Neil Wilson - 2014-01-31

    Sorry. I did actually type a backslash when writing the post, but apparently this stupid forum software requires you to type two backslashes to actually get one to show up.

     

Log in to post a comment.