Typing/Pasting Special Characters - %0A%0A or \n

Hellos,

I wish to paste / type special characters in a code which is not working

"%0A%0A"
"\n"

Everything else is being types / pasted

1 Like

Only context makes it possible for others to understand, help, and use their own time productively.


1 Like

HI ,

Thanks for the revert. My apologies for missing the context.

I'm making a simple Whatsapp Button allowing me(the user) to send a Whatsapp using KM to a phone number of my choice Mobile Number which is passed to KM as a variable Mobile. The following text is opened in Safari via Open in Browser action

" %0A%0A" below I used to format text in better way

hxxps://wa.me/91"&%Variable%Mobile%& "?text=Dear%20 Prashant" &"%0A%0A" &URLEncode("Sending you Work List Today:")
&"%0A%0A"&URLEncode("Hope you finished the Work Allocated To You)
&"%0A%0A"&URLEncode("DO NOT REPLY");

Have you tried a Filter action in these modes:

  • Percent Encode
  • Percent Decode

?


Filter with Percent Encode and Filter with Percent Decode.kmmacros (4.6 KB)

How are you getting those characters?

If you are entering them in a Text Field, then turn off processing tokens, otherwise %0A% and \n will be processed by Keyboard Maestro on entry in the field.

HI Peter , You mean Setting Below with Process Test Tokens Only ? This is failing

Screenshot 2022-05-02 at 11.43.10

Yes.

“This is failing” is insufficient information to debug your problem.

1 Like

HI Peter,
Thanks for your detailed reply. This makes it very clear. It simply didn't strike me that I could split my variable into multiple parts.

Thank you @ComplexPoint your suggestion of Percent Encoding works brilliantly too

You cannot both have Keyboard Maestro process “%Variable%Mobile%” and yet not process “%0A%”. They are both tokens.

There are a number of ways you can resolve this.

  • You could double every % in the text that is meant to just be a percent character. So “…&"%%0A%%0A"…”. Make sure you get all of them, including the “%20”.
  • You could build the variable up in multiple parts, some of which process tokens and some of which do not. For example:
    • Set Variable URL to text “hxxps://wa.me/91"&” (processing nothing)
    • Append to Variable URL with text “%Variable%Mobile%” (processing normally)
    • Append to Variable URL with text “& "?text=Dear%20…” (processing nothing)

There are lots of other ways, but whatever way you choose you have to handle the percent character appropriately, processing them or quoting them by doubling them or stopping them from being processed.

I somehow edited my reply and messed up a perfectly good thread

Thank you @peternlewis and @ComplexPoint

2 Likes