Here's one of such jolly features. Many LaTeX users may find it very useful.
Loading a text file with encoding auto-detectionHere's a LaTeX document consisting of a Polish poem. Probably, most of you wouldn't have been able to guess the file's character encoding if I hadn't left some hints. But it's OK, we have a little challenge.
Let's use some (currently experimental) stringi functions to guess the file's encoding.
First of all, we should read the file as a raw vector (anyway, each text file is a sequence of bytes).
Let's try to detect the file's character encoding automatically.
Encoding detection is, at best, an imprecise operation using statistics and heuristics. ICU indicates that most probably we deal with Polish text in ISO-8859-2 (a.k.a. latin2) here. What a coincidence: it's true.
Let's re-encode the file. Our target encoding will be UTF-8, as it is a “superset'' of all 8-bit encodings. We really love portable code:
Of course, if we knew a priori that the file is in ISO-8859-2, we'd just call:
So far so good.
Word countLaTeX word counting is a quite complicated task and there are many possible approaches
to perform it. Most often, they rely on running some external tools (which may be a bit inconvenient for some users). Personally, I've always been most satisfied with the output produced by the KileLaTeX IDE for KDE desktop environment.

As not everyone has Kile installed, I've had decided to grab Kile's algorithm (the power of open source!), made some not-too-invasive stringi-specific tweaks and here we are:
Some other aggregates are also available (they are meaningful in case of any text file):
Finally, here's the word count for my R programming book (in Polish). Importantly, each chapter is stored in a separate .tex file (there are 30 files), so "clicking out” the answer in Kile would be a bit problematic:
Notably, my publisher was satisfied with the above estimate. 
Next time we'll take a look at ICU's very powerful transliteration services.
More informationFor more information check out the stringi package website and its on-line documentation.
For bug reports and feature requests visit our GitHub profile.
Any comments and suggestions are warmly welcome.