Skip to main content


 

Symptoms


When trying to send an email that contains HTML content using the K2 Process Email event, plus signs are converted to spaces (actual spaces, not (andamp#20"). When the process is called from a SmartForm and the SmartForm passes plus signs, they are translated to "andamp#43". How do I preserve the plus signs? I need to preserve them when sending HTML content that contains base64 embedded images, which have plus signs.

Source: andltimg width="595" height="220" src="data:image/pngbase64,/9j/4AAQSkZJRg+++andltsnipandgt" v:shapes="Picture_x0020_1"andgtandlt/fontandgtandlt/pandgt

Result From K2 Process Email Event
andltimg width="595" height="220" src="data:image/pngbase64,/9j/4AAQSkZJRg andltsnipandgt" v:shapes="Picture_x0020_1"andgtandlt/fontandgtandlt/pandgt

Result from SmartForm
andltimg width="595" height="220" src="data:image/pngbase64,/9j/4AAQSkZJRgandamp#43andamp#43andamp#43andltsnipandgt" v:shapes="Picture_x0020_1"andgtandlt/fontandgtandlt/pandgt
 

Diagnoses


The underlying issue is that a "+" sign represents a SPACE in base64 -- it's one of the non alphanumeric characters it uses for padding.
 

Resolution

To keep the image URL from getting malformed at runtime, first ?URL encode? the image URL prior to passing it to the process(EmailBody) as an input. The process then URL decode it back at runtime... this way the data is preserved as is with the + signs in the image URL i.e.

INPUT VALUE(parameter):
%3Cfont%3E%3Cp%3Ehello%3CBR%3E%3Cimg%20width%3D%22595%22%20height%3D%22220%22%20src%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):
andltfontandgtandltpandgthelloandltBRandgtandltimg width="595" height="220" src="data:image/pngbase64,/9j/4AAQSkZJRg+++" v:shapes="Picture_x0020_1"andgtandlt/fontandgtandlt/pandgt


 




 
Be the first to reply!

Reply