Duplicate account, apologies, but quick question about text formatting

Hi folks, I'm @John_Gilmore but can't seem to find my old login info and I don't have the email address (ends in @xyz) that might be associated with this account. So I built a new one.

I've created a little macro that takes text and builds it into a complicated html page this morning, and it's working great except it's spitting out text with some funky characters. For example:

translating this:

It is wonderful and I just love the fact that they can exchange them out you know if they don’t fit, they don’t like them, and new shoes every week if they want you know.

to this:

It is wonderful and I just love the fact that they can exchange them out you know if they don’t fit, they don’t like them, and new shoes every week if they want you know.

Can anyone help me understand the problem I'm having with those apostrophes? I'm guessing I need to filter my variable before I send it through.

I have figured out my problem is curly quotes and curly apostrophes. I cleaned them up on my PRE text and my POST text looks fine.

Is there a way I can do this in a macro?

Hi John,

Sure, that's easy enough. Just make sure to replace the variable referenced here with the relevant text source for your macro:

Straighten Curly Quotes and Apostrophes.kmactions (836 Bytes)

1 Like

Is there a way to use RegEx to convert straight double-quotes to curly double quotes.

Example: change "Bill" to “Bill”.

Well, I see the forum page changed the straight quotes automatically. Anyway, I think you know what I mean.

There is indeed:

Search and Replace.kmactions (478 Bytes)
image

Regex: (?>"([^"]+)")

This isn't foolproof, as it won't be able to properly handle a double quoted string within a double quoted string, but in many cases it should be good enough, and certainly better than replacing them manually. This sample action searches the clipboard by default, but you can change that to a variable or file easily enough.

1 Like

That’s perfect. Thank you so much.

1 Like