On Thu 13 Mar 2025 at 01:03 +0100, Emmanuel Lécharny wrote: > There is a class that check that the syntax is correct: > org.apache.directory.api.ldap.model.schema.syntaxCheckers.PostalAddressSyntaxChecker
I'm not quite sure what you're trying to tell me with that. For this proposal, I first looked at how the Generalized Time syntax is handled already and for that there's functionality for checking the syntax here: org.apache.directory.api.ldap.model.schema.syntaxCheckers.GeneralizedTimeSyntaxChecker And functionality for decoding & encoding here: org.apache.directory.api.util.GeneralizedTime So it seemed logical to me to follow that same layout now also for the Postal Address syntax. Don't you agree? > […], what you probably need is a way to create a syntaxically correct > Postal Address accordingly to the RFC, Yes, exactly, that's the functionality that I now propose to copy the implementation of from Studio, that's the purpose of this proposal here. > Actually, calling it escape() instead of encode might make sense, > because you just want to produce a syntaxically correct address. Sure, we can call it whatever we want. > But let me ask: how will you know if the '$' should be escaped (if it's > part of a line)? This is actually very simple, the RFC specifies exactly 3 characters that must be escaped and these must always be escaped and there's even an example in the RFC with a '$' that's part of a line: \241,000,000 Sweepstakes$PO Box 1000000$Anytown, CA 12345$USA $1,000,000 Sweepstakes PO Box 1000000 Anytown, CA 12345 USA https://www.rfc-editor.org/rfc/rfc4517.html#section-3.3.28 No ambiguity. See also the unit tests currently in Studio, which I would copy too: https://github.com/apache/directory-studio/blob/master/plugins/ldapbrowser.core/src/test/java/org/apache/directory/studio/ldapbrowser/core/utils/UtilsTest.java Cheers // Fredrik Roubert -- Forsterstrasse 64 | +41 78 8170377 CH-8044 Zürich | https://roubert.name/fredrik/ --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
