WYSIWYG editor add %20 to links

The place to talk about things that are related to CMS Made simple, but don't fit anywhere else.
Post Reply
luppa
New Member
New Member
Posts: 6
Joined: Sun Jun 10, 2012 2:31 pm

WYSIWYG editor add %20 to links

Post by luppa »

I have a lot of links of type {cms_selflink href='page' anchorlink='anchor'} on my page. Just the {cms_selflink href='page'} seems to work fine, but if add the anchorlink, the WYSIWYG editors put %20 in the spaces. Then the whole page gives out an error.

I would just use html, but my client wants to use some type of WYSIWYG. First I tried the MicroTiny that came with the fresh install. with that, if I edit the link in WYSIWYG, the %20's keep being added. Then I installed TinyMCE, which I would prefer over MicroTiny, but it's even worse: if I edit something (_not_ the links) on the page and save, all the links magically change.

Any suggestions?
JohnnyB
Dev Team Member
Dev Team Member
Posts: 731
Joined: Tue Nov 21, 2006 5:05 pm

Re: WYSIWYG editor add %20 to links

Post by JohnnyB »

The %20 is because there are spaces in the URL. I've seen this happen most often when installed on a Windows based server (WAMP) and especially if the client needs to link to images or documents located on the server.

I did have a client with the above situation (WAMP and trying to link to files on their local server with spaces in the name) that was resolved by changing the character encoding.
"The art of life lies in a constant readjustment to our surroundings." -Okakura Kakuzo

--
LinkedIn profile
--
I only speak/write in English so I may not translate well on International posts.
--
luppa
New Member
New Member
Posts: 6
Joined: Sun Jun 10, 2012 2:31 pm

Re: WYSIWYG editor add %20 to links

Post by luppa »

JohnnyB wrote:The %20 is because there are spaces in the URL. I've seen this happen most often when installed on a Windows based server (WAMP) and especially if the client needs to link to images or documents located on the server.

I did have a client with the above situation (WAMP and trying to link to files on their local server with spaces in the name) that was resolved by changing the character encoding.
I think I got misunderstood. The %20's are not added serverside. The wysiwyg editor adds them, on the client browser side.

The thing that's happening is, if I select a part of text, then use a tool to make an in-site-link, the result looks like this:
{cms_selflink href='page'}
And that works just fine! But I have those anchors, that I want to use. So, with the editor, I edit the link, to add the anchor point, like so:
{cms_selflink href='page' anchorlink='anchor'}
But after editing, it has changed to:
{cms_selflink%20href='page'%20anchorlink='anchor'}

CMSMS doesn't like that. The whole page goes down with an error. If I use tinyMCE for editing, I won't even have to edit any links - the %20's magically appear to all the links with anchorlink defined on the page.

The link itself, the link that get's generated by that cms_selflink code, does not contain any spaces. I am not trying to point to any files or directories that have spaces in their names.
User avatar
velden
Dev Team Member
Dev Team Member
Posts: 3497
Joined: Mon Nov 28, 2011 9:29 am

Re: WYSIWYG editor add %20 to links

Post by velden »

{cms_selflink href=} suggests your building the links yourself:
<a href="{cms_selflink href="pagealias"}"> link text </a>
From that point of view it seems okay for tinyMCE to convert spaces to %20. Apparently TinyMCE does not recognize the smarty tag.

have a look at Extensions -. TinyMCY --> Advanced (Tab):
Avoid link conversion:

Turns TinyMCE's builtin link conversion logic off. Makes {smarty}-usage in urls possible.
JohnnyB
Dev Team Member
Dev Team Member
Posts: 731
Joined: Tue Nov 21, 2006 5:05 pm

Re: WYSIWYG editor add %20 to links

Post by JohnnyB »

When editing CMSMS tags - anything between the curly brackets {} - I almost always disable the WYWIWYG editor, which is also called, "HTML View", because the editor can corrupt tags by doing things like that.
"The art of life lies in a constant readjustment to our surroundings." -Okakura Kakuzo

--
LinkedIn profile
--
I only speak/write in English so I may not translate well on International posts.
--
Post Reply

Return to “The Lounge”