Forum

Thread tagged as: Question, Problem, Field-Types

How do I prevent ® and ™ in slugs

I have the latest version of Perch running on a client's website and have a News stream, that is the basis for an RSS feed.
Once in a while the client mentions registered trademarks in the text field, that is used to create the slug.
Unfortunately the slug still contains the ® as is.
I suspect, that is due to some server setting.
How do I force symbols like ® and ™ to be converted to regular letters—or even better have them completely parsed out (dunno, if that is the correct expression).

Nils Mielke

Nils Mielke 3 points

  • 6 years ago
Drew McLellan

Drew McLellan 2638 points
Perch Support

They should be already. Can you show us your diagnostics report?

Hi Drew,
here's the report (I xxx-ed some of the stuff out for security reasons). Let me know, if you need more information.

Perch: 2.8.13  
Production mode: Production (100)  
Installed apps: content (2.8.13), assets (2.8.13), categories (2.8.13), perch_forms (1.7), perch_mailchimp (2.0.1), perch_backup (1.2)  
DB driver: PDO  
DB tables: perch2_categories, perch2_category_counts, perch2_category_sets, perch2_content_index, perch2_content_items, perch2_content_regions, perch2_forms, perch2_forms_responses, perch2_mailchimp_campaigns, perch2_mailchimp_history, perch2_mailchimp_log, perch2_mailchimp_stats, perch2_mailchimp_subscribers, perch2_navigation, perch2_navigation_pages, perch2_page_templates, perch2_pages, perch2_resource_log, perch2_resource_tags, perch2_resources, perch2_resources_to_tags, perch2_settings, perch2_user_privileges, perch2_user_role_privileges, perch2_user_roles, perch2_users  
Users: 4  
App runtimes:  
<?php  
    $apps_list = array(  
        'content',  
        'categories',  
        'perch_forms',  
        'perch_mailchimp'  
    );  
    include(PERCH_PATH.'/addons/xxx.class.php');  
Scheduled tasks for perch_mailchimp: update_list_stats (60 mins)  
Editor plug-ins: markitup  
H1: xxx  
L1: xxx  
headerColour: #839088  
content_singlePageEdit: 1  
helpURL:  
siteURL: /  
hideBranding: 1  
content_collapseList: 1  
lang: en-gb  
update_2.5.1: done  
latest_version: 2.8.8  
on_sale_version: 2.8.13  
headerScheme: dark  
perch_backup_mysqldump_path:  
dashboard: 0  
hide_pwd_reset: 0  
content_hideNonEditableRegions: 0  
content_frontend_edit: 0  
logoPath: /p/resources/xxx  
update_2.5.4: done  
update_2.6: done  
update_2.6.2: done  
update_2.6.3: done  
perch_mailchimp_secret: xxx  
perch_mailchimp_update: 2.0  
perch_mailchimp_api_key: xxx  
perch_mailchimp_list_id: xxx  
perch_mailchimp_campaign_url: /mailchimp/campaign.php?s={campaignSlug}  
update_2.7.8: done  
update_2.7.10: done  
update_2.8.8: done  
update_2.8.13: done  
PERCH_DEVELOPMENT: 10  
PERCH_STAGING: 50  
PERCH_PRODUCTION: 100  
PERCH_DB_USERNAME: xxx  
PERCH_DB_SERVER: localhost  
PERCH_DB_DATABASE: xxx  
PERCH_DB_PREFIX: perch2_  
PERCH_TZ: UTC  
PERCH_EMAIL_FROM: xxx  
PERCH_EMAIL_FROM_NAME: xxx  
PERCH_EMAIL_METHOD: sendmail  
PERCH_LOGINPATH: /p  
PERCH_PATH: xxx  
PERCH_CORE: xxx  
PERCH_RESFILEPATH: xxx  
PERCH_RESPATH: /downloads  
PERCH_HTML5: 1  
PERCH_PRODUCTION_MODE: 100  
PERCH_RUNWAY:  
PERCH_ERROR_MODE: DIE  
PERCH_DATE_LONG: %d %B %Y  
PERCH_DATE_SHORT: %d %b %Y  
PERCH_TIME_SHORT: %H:%M  
PERCH_TIME_LONG: %H:%M:%S  
PERCH_DEBUG:  
PERCH_PREVIEW_ARG: preview  
PERCH_TEMPLATE_PATH: xxx  
PERCH_DEFAULT_DOC: index.php  
PERCH_DEFAULT_EXT: .php  
PERCH_RWD:  
PERCH_HTML_ENTITIES:  
PERCH_SSL:  
PERCH_STRIPSLASHES:  
PERCH_PROGRESSIVE_FLUSH: 1  
PERCH_AUTH_PLUGIN:  
PERCH_DB_CHARSET: utf8  
PERCH_DB_PORT:  
PERCH_DB_SOCKET:  
PERCH_SESSION_TIMEOUT_MINS: 20  
Hosting settings  
PHP: 5.4.45-1~he.1  
Zend: 2.4.0  
OS: Linux  
SAPI: apache2handler  
Safe mode: not detected  
MySQL client: mysqlnd 5.0.10 - 20111026 - $Id: xxx $  
MySQL server: 5.5.44-37.3-log  
Extensions: Core, date, ereg, libxml, openssl, pcre, dba, dom, fileinfo, filter, hash, json, bz2, posix, Reflection, SPL, SimpleXML, session, standard, sysvmsg, sysvsem, sysvshm, tokenizer, xml, xmlreader, xmlwriter, apache2handler, imagick, bcmath, zlib, calendar, ctype, curl, mbstring, ftp, gd, geoip, gettext, iconv, imap, intl, ldap, exif, mcrypt, mysqlnd, mysqli, mysql, PDO, pdo_mysql, pdo_sqlite, PDFlib, tet, pspell, shmop, soap, sockets, sqlite3, suhosin, tidy, timezonedb, wddx, xmlrpc, xsl, zip, Phar, mhash, ionCube Loader, Zend Guard Loader  
GD: Yes  
ImageMagick: Yes  
PHP max upload size: 32M  
PHP max form post size: 32M  
PHP memory limit: 256M  
Total max uploadable file size: 32M  
Resource folder writeable: Yes  
Session timeout: 24 minutes  
Native JSON: Yes  
Filter functions: Yes  
Transliteration functions: Yes  
HOME: xxx  
USER: xxx  
HTTP_HOST: xxx  
HTTP_X_REAL_IP: xxx  
HTTP_X_FORWARDED_FOR: xxx  
HTTP_CONNECTION: close  
HTTP_USER_AGENT: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.10; rv:35.0) Gecko/20100101 Firefox/35.0  
HTTP_ACCEPT: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8  
HTTP_ACCEPT_LANGUAGE: de,en-US;q=0.7,en;q=0.3  
HTTP_ACCEPT_ENCODING: gzip, deflate  
HTTP_REFERER: xxx  
HTTP_COOKIE: __utma=xxx; _ga=xxx; cmsa=1; PHPSESSID=xxx  
PATH: /bin:/usr/bin:/usr/ucb:/usr/bsd:/usr/local/bin  
SERVER_SOFTWARE: Apache  
SERVER_NAME: xxx  
SERVER_ADDR: xxx  
SERVER_PORT: 80  
REMOTE_ADDR: xxx  
DOCUMENT_ROOT: xxx  
SERVER_ADMIN: xxx  
SCRIPT_FILENAME: xxx  
REMOTE_PORT: 59453  
GATEWAY_INTERFACE: CGI/1.1  
SERVER_PROTOCOL: HTTP/1.0  
REQUEST_METHOD: GET  
QUERY_STRING: extended  
REQUEST_URI: /p/core/settings/diagnostics/?extended  
SCRIPT_NAME: /p/core/settings/diagnostics/index.php  
PHP_SELF: /p/core/settings/diagnostics/index.php  
REQUEST_TIME_FLOAT: 1442920319.661  
REQUEST_TIME: 1442920319  
argc: 1  
Drew McLellan

Drew McLellan 2638 points
Perch Support

Trademarks should be being correctly transliterated in your configuration.

I just realized, that trademarks (™) are converted to "tm", registered Rs (®) are not.
Tried it on a different web server. There it converts to an "r", which would be okay.
Any ideas, why that doesn't work on the configuration above?
I wouldn't mind, if the ® was skipped by the slug altogether, as that would help keep the URL more readable.

Drew McLellan

Drew McLellan 2638 points
Perch Support

Is the diagnostic above from the server where the transliteration isn't happening?

That's right.

Drew McLellan

Drew McLellan 2638 points
Perch Support

Are the files the same in both places?

No, they are not.
It is the same Perch version, but PHP 5.4.4 on the other machine (instead of 5.4.45-1 on the "faulty" machine).
It is another client's website on the server I used for testing, as that was the quickest way to see, if it is the default behavior, that the ® is not converted.

Drew McLellan

Drew McLellan 2638 points
Perch Support

Ok, well this is supposed to work, but it is dependant on the server being able to do the transliteration correctly.

I'll see if I can add another special cases to get this to work better.

Sounds great. Thanks a lot. I will have the client fix it manually for now.