There are a lot of configurable symbols in the pathauto settings (admin/config/search/path/settings).

However there aren't any settings for registered trademark (®) and trademark (™) symbols. I have a client that has a lot of node titles containing these characters, so I have patched the module to include them.

#1 pathauto-trademark_symbols-2065369.patch1.02 KBzhuber
PASSED: [[SimpleTest]]: [MySQL] 322 pass(es).
[ View ]


zhuber’s picture

Status:Active» Needs review
new1.02 KB
PASSED: [[SimpleTest]]: [MySQL] 322 pass(es).
[ View ]

I also added the copyright symbol, for good measure.

Dave Reid’s picture

You could just enable the 'Reduce to ASCII' option in Pathauto?

zhuber’s picture

Ahh...I didn't see that option.

Well, I think this is still a viable alternative if you didn't want to use the 'Reduce to ASCII' option.

enekoalonso’s picture

@Dave Reid, that solution does not work if you want to allow unicode URLs (for other languages).

In my opinion, Pathauto should allow to provide a custom list of symbols to be replaced, the same way it allows providing a list of words to be removed.

enekoalonso’s picture

Actually, it seems like there is a hook that can be used for this purpose (still would be nice to be able to do it through the UI):

 * Alter the list of punctuation characters for Pathauto control.
 * @param $punctuation
 *   An array of punctuation to be controlled by Pathauto during replacement
 *   keyed by punctuation name. Each punctuation record should be an array
 *   with the following key/value pairs:
 *   - value: The raw value of the punctuation mark.
 *   - name: The human-readable name of the punctuation mark. This must be
 *     translated using t() already.
function hook_pathauto_punctuation_chars_alter(array &$punctuation) {
// Add the trademark symbol.
$punctuation['trademark'] = array('value' => '™', 'name' => t('Trademark symbol'));

// Remove the dollar sign.
joshuautley’s picture

Issue summary:View changes

I patched the production release for this module and while I see the options on settings the registration symbol is not being removed.

Per Dave's suggestion I do not see "Reduce to ASCII" option in settings. Is this only available in the dev release?

Thanks in advance for any input on this.

mibfire’s picture


If you dont want to use unicode urls

then you have to turn off "Transliterate prior to creating alias" option, enable "Reduce strings to letters and numbers" option, and you dont need any patch for this or hook_pathauto_punctuation_chars_alter.

But there is a problem if your string contains characters with accent cos this case you have to use "Transliterate prior to creating alias" option and symbol will be converted with transliteration(for example: ™ -> TM) and after you cant remove this using "Punctuation" settings!


 * Implements hook_tokens_alter().
function MYMODULE_tokens_alter(&$replacements, $context) {
// Remove symbols from path generated with pathauto
if (isset($context['options']['pathauto']) && $context['options']['pathauto']) {
$replacements as $key => $value) {
$value = str_replace(array('®', '™'), array('', ''), $value);
$replacements[$key] = $value;

If you want to use unicode urls

then you have to turn off "Transliterate prior to creating alias" and "Reduce strings to letters and numbers" options, and use patch to remove the symbols.

JABurns103’s picture

The simplest solution is to select "Reduce strings to letters and numbers", and then you have to add the html character codes to the "Strings to Remove" box.

For example
Trademark ™ = & #8482;
Registered ® = & #174;
Copyright © = & #169;

*remove the space after the &

ferdinandnelson’s picture

This code will work on the trademark search. No one can registered there trademark expert so this will your trademark to get register in overall.