Forum
Creating Pages - URL has 20 rather than hyphen
When I create a page in Perch, I enter a page name with spaces. The filename that is then created has "20" in place of the space. I would normally expect a hyphen.
Diagnostic:
Perch: 2.8.29, PHP: 5.6.10, MySQL: mysqlnd 5.0.11-dev - 20120503 - $Id: 3c688b6bbc30d36af3ac34fdd4b7b5b787fe5555 $, with PDO
Server OS: Darwin, apache2handler
Installed apps: content (2.8.29), assets (2.8.29), categories (2.8.29), perch_blog (5.0), perch_events (1.9.2), perch_forms (1.8.3), perch_shop_orders (1.0), perch_shop_products (1.0), perch_shop (1.0.1), perch_members (1.5), perch_twitter (3.5.1)
App runtimes: <?php $apps_list = array( 'content', 'categories', 'perch_blog', 'perch_forms', 'perch_members', 'perch_shop', 'perch_events', 'perch_twitter', );
PERCH_LOGINPATH: /perch
PERCH_PATH: /PATH_TO/perch
PERCH_CORE: /PATH_TO/perch/core
PERCH_RESFILEPATH: /PATH_TO/perch/resources
Image manipulation: GD
PHP limits: Max upload 32M, Max POST 32M, Memory: 128M, Total max file upload: 32M
F1: 2edba60ed1f613d6dd804feb202456a2
Resource folder writeable: Yes
HTTP_HOST: local.include-ed.org.uk
DOCUMENT_ROOT: /PATH_TO
REQUEST_URI: /perch/core/settings/diagnostics/
SCRIPT_NAME: /perch/core/settings/diagnostics/index.php
Also, is there a way to make the default option when creating a page my Default Master page, rather than "Page already exists or is a link only"?
Just a
20
or a%20
?Just a "20" (though I guess it's related to "%20"). It's just a standard installation of the latest version of Perch on MAMP Pro.
If you view source on the HTML, do you get spaces or 20s?
The XHR Response "Urlify" has the content "test20page" if I add a page called "Test Page".
If I don't change it, the page it creates is called "test20pages.php".
Ok, that's interesting. Are you just typing the space or are you pasting it in from somewhere?
I'm just typing straight into the field. Thanks.
Just noticed this is also happening when I create a product - the slug is showing with 20s rather than spaces.
Adding this to the first line of the urlify function of PerchUtil.class.php around line 672 seems to resolve, but I can't see why it would be happening (and you may well have a better fix)...
Please don't hack at the core files, we can't really offer you support once you've started modifying things.
Which browser is this happening in? We can't reproduce it here, and haven't heard about it from anyone else - so in order to help we'll need to establish what's different.
Understood - I'll remove the hack. Was only a temporary thing on my local setup to try and identify a cause, rather than a permanent fix.
It's Safari 9.1, but the same thing also happens in Chrome.
Strangely, now that I've removed my hack, everything works as it should. Can't explain why but it does. Something to do with the character encoding of a particular file that got changed when I edited? Or something else?
Really strange! It could be - files should be saved as UTF8.