Encode text or substitute

Hi Gliders,

I was wondering if any of you has an idea how to encode text or alternatively use something like the substitute function but within the glide editor?

I have a need where I need to use a string of text within a url but I can’t use the glide construct url column as it doesn’t fit the structure of the url and I would very much like to avoid writing to the sheet for this as it creates a delay in the flow.

Appreciate any inputs you might have.

Thanks

@yinon_raviv can you give an example of the url you’re trying to create and what to exchange in the url

I’m trying to create an image with text overlay in cloudinary (which works using sheets function).
In order to do this I need to encode the text as well as replace some characters such as comma which breaks the cloudinary link (as comma used for the setting of the cloudinary transformation)

1 Like

Might be possible with a template column, replacing spaces with %20, etc. But you’d need to know the full set of characters that need to be replaced

@yinon_raviv if you give an example of what you want to achieve then it is easier for people to give some advise :stuck_out_tongue_winking_eye:

Actually, just had a thought - you might be able to do it with a URL column and a template column. Leverage the URL column to do the encoding, and then run the URL column through a template to strip out the bits you don’t need?

4 Likes

Way to go

Glide URL column is perfect for working with Cloudinary.

1 Like

That’s the problem, it’s a dynamic text the users entering.
Don’t have any way to know this in advance

The url column needs all the or most parameters fills in order to work so didn’t work but I’ll try again to see if there might be a different way to use it

Actually, I just did a test and it works fine with just a URL column.

  • Protocol: https
  • Host: res.cloudinary.com
  • Path: EVERYTHING ELSE
  • Query Parameters: Leave Blank

PS. Just to be clear, I tested using a complex URL with multiple text and image overlays that won’t work without being URL encoded - and it worked perfectly using the above.

It doesn’t work with text as the spaces breaks the link.
I’ll be at the PC later and will show you

Worked for me - with spaces and several other characters that need encoding.

2 Likes

Care to share print screen of the settings?

Here is a simple example:

Results in:

The one I tested with earlier used multiple image overlays and several lines of text, but I can’t share that one - you’ll just have to take my word that it worked :slight_smile:

1 Like

Yeah. Same here. The URL column will encode spaces along with other “unsuitable” characters so that the resulting URL is “compliant”.

Thanks will try again, maybe something with the Hebrew not working well or maybe it’s the comma I have in the text which breaks the link if cloudinary

I think you’re right. Including commas in the text breaks it - even with English text.
I just did some more testing and it appears that the URL column only encodes the parameters - not the path part of the URL construct. I think the fact that it was working for me last night was probably just a fluke. So maybe it’s back to my earlier idea…

The idea I had was to include your entire Cloudinary URL as the parameter part of the URL column (with dummy values for the protocol/host/path), and then use a template column to strip those (and the parameter name) out, leaving just the encoded URL. But I’m not really sure if that will work - I’ll try and find some time to do some testing with it today.

This is what I tried doing but when putting something in the parameters it adds a question mark or equal sign to the link which is not working with cloudinary link

@yinon_raviv take a look at this:

I was able to get it working by using the second method (replacing commas with %E2%80%9A), and then using the result as a replacement in a normal template column (no need for the URL column).

Give that a try and see if it works for you.

Update: Here is a template that double-escapes the standard set of “reserved” characters that are used in a Cloudinary URL…

Using that template, you can take a string of text that looks like this: the, quick: brown/ fox_
And turn it into this: the%252C quick%253A%250A brown%252F%250A fox_%250A
And then that works in a Cloudinary URL

3 Likes