Non breaking spaces (nbsp) in page names


(Margaret Chatwin) #1

Matrix Version: 6.20.2

I’m not sure if this is intended behaviour, but I don’t think I’ve ever encountered it before, in my 20-odd years of using Matrix.

Non breaking spaces ( ) are being retained in page names. I was alerted because I had a page title (coming from the parse file with %asset_name%) overflowing its bounding box. I started by looking at the CSS, but when I inspected the code I could see a   between each word. I would have thought they’d be stripped out of a page name?

So if it’s not a bug and is in fact intended, is there a workaround? A setting? Or can anyone suggest a keyword modifier that won’t mess up other html entities such as ampersands, apostrophes, etc?

Thanks!


(Iain Simmons) #2

Hi Margaret,

There’s a good chance that the page titles were copied and pasted from another program. Microsoft Word in particular is notorious for adding lots of additional characters that you wouldn’t typically use on a regular web page (including smart quotes, additional line breaks of different types, etc).

There’s not a great way around that aside from typing in the title manually instead of copying and pasting.

As for replacing those characters with keywords, you could either try replacing the HTML entity directly or the unicode character. You might need to try both:

HTML entity

%asset_name^replace: : %

Unicode

%asset_name^replace:\xc2\xa0: %

Hope that works!

– iain


(Margaret Chatwin) #3

Thanks Iain,

Yes, I suspect the titles have been pasted from Word in this case. It just surprises me that in all these years of Matrix use, I’ve never encountered a title unable to wrap (and a web path with no _ or - because they only replace actual spaces). I’m certain there would have been many editors copying and pasting their titles rather than typing them in. I just assumed Matrix was set up to strip them out of the page name field upon save.

However, that doesn’t appear to be the case now, so thanks for the keyword modifiers, it’s much appreciated - I will give those a try.

Cheers,

Margaret