slug-generator icon indicating copy to clipboard operation
slug-generator copied to clipboard

Should we make sure that the delimiter is part of the valid chars?

Open ausi opened this issue 8 months ago • 2 comments

See https://github.com/contao/contao/issues/8325

ausi avatar Jun 07 '25 07:06 ausi

I think this could be problematic when using delimiters that are more than one character wide, e.g.:

$generator->generate('Hello World!', ['delimiter' => '%20']); // Result: hello%20world

In this case you probably don’t want to allow the % character in the rest of the string, e.g.:

$generator->generate('Now -10% dicount!', ['delimiter' => '%20']); // Result: now%2010%20dicount

@aschempp what do you think?

ausi avatar Jun 07 '25 07:06 ausi

Personally I would use a whitespace in this case and replace it later on. But you're right that this could be a problem.

aschempp avatar Jun 10 '25 06:06 aschempp