This article was created in response to a support issue logged with K2. The content may include typographical errors and may be revised at any time without notice This article is not considered official documentation for K2 software and is provided “as is” with no warranties.

Issue

When sending an email that contains HTML content using the K2 Process Email event, plus signs are converted to spaces (actual spaces, not ("). When the process is called from a SmartForm and the SmartForm passes plus signs, they are converted to "+".

This article explains how to preserve the plus signs when sending HTML content that contains base64 embedded images with plus signs.

Symptoms

The underlying issue is that a "+" sign represents a space in base64 as it is one of the non alphanumeric characters it uses for padding.

Troubleshooting Steps

Please note: You can use https://www.base64-image.de/  to encode an image

Source: <img width="595" height="220" src="data:image/png;base64,/9j/4AAQSkZJRg+++<snip>" v:shapes="Picture_x0020_1"></font></p>

Result From K2 Process Email Event
<img width="595" height="220" src="data:image/png;base64,/9j/4AAQSkZJRg <snip>" v:shapes="Picture_x0020_1"></font></p>

Result from SmartForm
<img width="595" height="220" src="data:image/png;base64,/9j/4AAQSkZJRg&#43;&#43;&#43;<snip>" v:shapes="Picture_x0020_1"></font></p>

Keep the image URL from being distorted at runtime by first “URL encoding” the image URL prior to passing it to the process(EmailBody) as an input. The process will then URL decode it back at runtime. This way the data is preserved as is with the + signs in the image URL. See the example below: 

INPUT VALUE(parameter):
%3Cfont%3E%3Cp%3Ehello%3CBR%3E%3Cimg%20width%3D%22595%22%20height%

3D%22220%22%20

src%3D%22data%3Aimage%2Fpng%3Bbase64%2C%2F9j%2F4AAQSkZJRg%2B%2B%2B%22%

20v%3Ashapes%3D%22Picture_x0020_1%22%3E%3C%2Ffont%3E%3C%2Fp%3E

OUTPUT VALUE(process runtime):
<font><p>hello<BR><img width="595" height="220" src="data:image/png;base64,/9j/4AAQSkZJRg+++" v:shapes="Picture_x0020_1"></font></p>