Set URL SEF not active.
Create a menu item of tagged-elements of a specific category
Valid HTML in page.
Menu links should be something like:
Invalid HTML is emitted, '[' and ']' are used:
At least Joomla 3.4 to 3.7.4
In ModMenuHelper::getList (/modules/mod_menu/helper.php) at row 133 add:
// Encode '[' and ']' if emitted by any component route (i.e. com_tags 'tagged elements list' menu item does) $item->flink = preg_replace(array ('/\[/u', '/\]/u'), array('%5B', '%5D'), $item->flink);
We came from joomla-framework:master PR #21. It was closed as the proposed solution seemed too deep and a potential B/C.
The solution proposed here is limited to menu links generated by mod_menus, at presentation layer.
preg_replace really needed (to uses
u PCRE modifier for unicode)?
JRoute constructor (libraries/joomla/application/route.php) at row 93 does so to replace spaces.
Or should we use
No Code Attached Yet
|Category||⇒||com_tags Router / SEF|
For reference on why having  characters in a url is not good https://perishablepress.com/stop-using-unsafe-characters-in-urls/
 not being in URLs has practicality issues.
<?php version_compare(PHP_VERSION, '7.0', '>=') or die('Go PHP 7 already'); var_dump($_GET); $queryString = $_SERVER['QUERY_STRING'] ?? ''; ?> <!DOCTYPE html> <html lang="en"> <head> <title>Form Tester</title> </head> <body> <form method="get"> <label for="tag-1">Tag 1</label> <input id="tag-1" name="tag" value="<?php echo $_GET['tag'] ?? ''; ?>"> <label for="tag-2">Tag 2</label> <input id="tag-2" name="tag" value="<?php echo $_GET['tag'] ?? ''; ?>"> <button type="submit">Submit</button> </form> <a href="form.php<?php echo !empty($queryString) ? "?$queryString" : ''; ?>">Current Page Link</a> </body> </html>
When the form submits, the (unencoded) query string ends up as
?tag=Foo&tag=Bar. My browser did encode the values and the var_dump had
$_GET in the expected structure. So the fact that the brackets are encoded in and of itself is NOT an issue as long as they are handled correctly. Likewise, the current link (even encoded) results in the expected behavior.
So, specifically now, what is the issue, other than the use of encoding in the URL?
I see no problem in your example. It validates ok on https://validator.w3.org (after moving php code inside
The problem is in the page emitted by Joomla! in the conditions I explained. Could you reproduce it?
In your example the broswer has responsability to do the job and does it correctly.
In the case I described the broswer has no role in generating the link, the query string, that is emitted as passed by Joomla! code, unencoded, and it does not validate.