When creating a new page via the add content popup, any title i use has all the spaces replaces with a plus.

Is this normal behaviour?

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

chriz001’s picture

Title: Spaces get replaces with + » Spaces get replaced with +

fix title typo

btopro’s picture

hmm... never seen that before; browser details please

chriz001’s picture

Oops, sorry i forgot to respond to this.

Chrome Version 27.0.1453.110

Brian MacKinney’s picture

Can confirm this bug in Chrome and Firefox, when creating new nodes or when updating node titles.

btopro’s picture

is this still in the latest dev?

Regardless I'm going to wait as datvance seemed to suggest in the Reordering thread that this will have an additional patch to resolve coming shortly.

Brian MacKinney’s picture

Version: 7.x-2.0-rc2 » 7.x-2.x-dev
Issue summary: View changes

Yes, in the latest Dev. Ditto on hope that datvance can find patch here.

datvance’s picture

Ok, here's a little patch, but I would test it thoroughly. It looks simple, but there are a lot of moving parts and the underlying issues are actually pretty complex. I'm not sure if this fixes everything going on, I still occasionally see odd stuff with html entities in the titles, but I think that has to do with #4 below.

1. Apache and mod_rewrite encode urls slightly differently, which causes problems with special characters, which is why OD does that weird @2@6@ stuff.
see http://stackoverflow.com/questions/459667/how-to-encode-special-characte...

Ideally, I think Drupal should use the "B" or NE" flag in it's .htaccess. See http://httpd.apache.org/docs/current/rewrite/flags.html
If you're not on Apache, then I don't know how the rewriting/encoding works and I got nothing.

2. Firefox and Chrome seem to encode spaces differently (%20 vs +). I didn't even mess with other browsers.

3. PHP, js/jQuery, and Drupal are all doing some encoding/decoding of their own which you have to take into account.

4. The "reload_table" trigger resubmits the form, which seems to cause some problems in some instances especially on Chrome (e.g. refreshing the page submits again?). It was hard to track down, but again, not sure why it needs to do this.

5. This could all mostly be avoided if Outline Designer didn't submit it's ajax data in the URL. I'm not sure why it's doing that instead of just sending it in the POST, but it would make it a lot simpler. I prototyped that out and it seemed to work well, but it requires a fairly major structural change in OD.

Anyway, all that said, this patch is working for me in production with no complaints from users, but I don't have a lot of confidence in it as a permanent fix for everyone.

btopro’s picture

Thank you for tracking this down as well as explaining why my code probably looks really stupid in this area ;)

As per #4 have had issues tracking that down as well, I know not issuing it was causing issues in some browsers.

#5 This is a case of technical debt that's found its way along from Drupal 5 and then the Drupal 6 rewrite of the module helped clean up the ajax (imagine it even worse ;)). I'd gladly accept code restructuring to accomplish this as it's definitely needed and would resolve all issues associated with encoding.

I'd rather it be done the right way then accept this patch at this time. Applying it I didn't experience any issues but I've also not experienced this myself previously.

katyrose’s picture

Is a more permanent fix for this bug going to be deployed any time soon?

btopro’s picture

I'll commit it if others confirm that this patch fixed the issue for them. We've never witnessed it and we use this on hundreds of sites. Patch is very simple / sane looking, I'm just looking for people who have this issue who then use the patch and it corrects the issue for them to confirm this aside from the original patch poster.

btopro’s picture

Status: Active » Needs review
btopro’s picture

tested on simplytest me. this appears to be a partial fix. When you get into funky character land outline designer seems to get annoyed at updating things. The patch is a temporary fix, a real solution would be POSTing JSON messages and then decoding on the other side; which still could have some issues in the presentation layer but is less likely.

This allows for saving those items more accurately but the & character gets HTML encoded when the AJAX message is sent back, causing it to be listed as the full & item, which still causes issues on transmission. I do think this would clear up a few issues if others would confirm that this is working for them before pushing out this change.

  • btopro committed da80305 on 7.x-2.x
    fixed rename and entity encoding / decoding in a manner similar to #...
btopro’s picture

Status: Needs review » Fixed

Fixed in testing, different then patch but similar and also resolves issue with Renaming of items with spaces / funky characters

katyrose’s picture

Great! Update is working well for me. No more annoying characters. Thanks!

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.