Plus signs in the Email event are being translated to hexadecimal code + or converted to space

  • 24 February 2022
  • 0 replies
  • 6 views

Userlevel 5
Badge +20
 

Plus signs in the Email event are converted to hexadecimal code + or into a space

KBS100042

PRODUCT
K2 blackpearl 4.6.11
BASED ON
K2 blackpearl 4.6.11
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.
LEGACY/ARCHIVED CONTENT
This article has been archived, and/or refers to legacy products, components or features. The content in this article is offered "as is" and will no longer be updated. Archived content is provided for reference purposes only. This content does not infer that the product, component or feature is supported, or that the product, component or feature will continue to function as described herein.

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&colon;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&colon;image/png;base64,/9j/4AAQSkZJRg <snip>" v:shapes="Picture_x0020_1"></font></p>

 

Result from SmartForm
<img width="595" height="220" src="data&colon;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&colon;image/png;base64,/9j/4AAQSkZJRg+++" v:shapes="Picture_x0020_1"></font></p>


0 replies

Be the first to reply!

Reply