Command line app to scan email templates, are all their characters within ASCII range

§ Quick Take

Call on one file:

ran on one file

Call just the application and it will let you choose a file from that folder:

ran without any arguments

Call on multiple files all at once:

ran on multiple files all at once

§ Use it

Once installed, call it on a file:

withinascii YOURFILE.html or

tinaturner "templates/YOURFILE.html"

Whichever is easier for you to remember.

§ Idea

This CLI app will check, does your HTML file (or some other extension) contains non-ASCII characters.

Specifically, it will check, are your file contents suitable for 7bit encoding, in other words, are all characters within the basic ASCII range opens in a new tab, the first 126^ characters. However, only this check would be short-sighted, as invisible control characters (anything below decimal point 32) fall within ASCII range but are bad.

We don't want any invisible control characters (anything below decimal point 32), EXCEPT:

^ Also, we don't want character at a decimal point 127, DEL opens in a new tab, which technically falls within basic ASCII range but might appear broken in email-consumption software.

§ Practical use

We're going to use this library to validate our email templates, as a part of final QA. In theory, all email templates should be HTML encoded and have no characters outside the basic ASCII range (or invisible control characters like ETX). In practice, all depends on the server, because your ESP back-end might encode the rogue characters for you. But it might not, and you'd be in trouble.

We're going to prepare for the worst and deliver all our templates ready for ANY encoding, conforming to 7bit spec: no characters beyond first 126 decimal point.

PS. It's 126, not 127 because 127 is "invisible" DEL opens in a new tab character which is not acceptable in templates.

Check out the API version which works well in Gulp environment.

§ Changelog

See it in the monorepo opens in a new tab, on Sourcehut.

§ Licence

MIT opens in a new tab

Copyright © 2010–2020 Roy Revelt and other contributors

Related packages:

📦 email-all-chars-within-ascii 2.10.1
Scans all characters within a string and checks are they within ASCII range
📦 email-homey 2.8.0
Generate homepage in the Browsersync root with links/screenshots to all your email templates
📦 email-comb 4.0.5
Remove unused CSS from email templates