Entradas

Mostrando entradas de junio, 2018

Mail subject with non-standard characters

Imagen
I was thinking about good example uses for the Base64 Encoding utility I posted last week, and then I remembered: e-mails! Sending an e-mail from your application is a pretty common task. Let's say your client wants to be automatically informed when some conditions are met in the plant. So you do it, and probably use the Send Email using SMTP Cient.vi that comes with LabVIEW (since LV2013) and allows the use of secure mail servers, as Gmail. So far, so good. But what happens when you put some non-English characters in the subject line? This is usual for us Spanish speakers, and the results are not as intended, but garbage text on the other side. The answer is to use an encoded-word syntax . In this case we'll use Base64 and the VI I uploaded . The change needed in the mail client VI is minimum: Just encode the text in Base64, encapsulate it as indicated, and your subject line will be readable in any mail client, as you can see in the lower image.

Base64 Encoding

Imagen
Long time no see! Today I'm here to talk about Base64 encoding and how to do it in LabVIEW. What is Base64 and what is used for? Base64 is a six-bit based encoding mechanism that uses only printable characters from the ASCII table (lower and upper case letters, numbers, and three more characters, usually "+/="). This means it can be represented in any textual environment, though obviously adds an overhead respect to the original code since two bits of every byte are unused. You will find B64 mainly in mail applications (to send attachments), but lately it's been popular in URLs and HTML too. The concept is to insert small chunks of data directly as B64 text to avoid recurrent callings for files through the web. For example, you can embed an image inside your HTML or CSS file. It's not my intention to delve too deep in this aspect, but for an image tag the resulting HTML code would look like this (let's assume a JPG file): <img src="data:imag