Swung dash in LaTeX

There’s a character called a “swung dash”, which is like a long, gently wavy hyphen. In Unicode it’s U+2053, and if your font supports it, it might look like ⁓. In some fonts it looks a bit flat, I think.

I was asked recently to implement one in LaTeX. Checking the Comprehensive LaTeX Symbol List there is just a simple reference to use a mathematical \sim, but \sim isn’t quite the same. It’s a much curvier shape, and just doesn’t look right.

\sim compared to \swungdash
\sim compared to \swungdash

So, here’s my alternative command. Basically it’s just an extra-big tilde pulled down a bit. It’s not dramatically different, but it’s closer to what I think it should be, and the person asking for it is happier with it:

You’ll need to include the graphics or graphicx packages to make the \raisebox work.

PHP and Unicode

In my last post about the testing goat I mentioned there’s now an official Unicode codepoint for “GOAT”, U+1F410.

At the time, I tried typing it in. Under Linux you just press ctrl-shift-u (you’ll see an underlined letter u), type the hex digits for the code you want, press space and continue on. Easy. Having installed the free Symbola font, I could see my little goat in the editor. Happy Days!

Until I went to preview the post, at which point my little goat, and everything after it, had disappeared. Fortunately it was the last thing in my post, but if it was higher up I’d have lost some of my work. Not good! It was late and I was tired so I left it out, a little disappointed.

So, looking again this evening I found that there’s a known problem that WordPress gets confused if it sees a Unicode character above U+FFFF. If you install the Full UTF-8 plugin, it works again. Without a doubt, this plugin, or something like it, should be merged into the core. Right now.

PHP and Unicode

In my job I have the dubious pleasure of maintaining a very old PHP application. Several hoops are jumped through to keep UTF-8 characters intact, but the hoops still work so I generally just leave it alone. This WordPress issue just had me googling again, and it seems to confirm that PHP (which is the language WordPress is written in) still doesn’t support Unicode natively. Really. In 2014.

It seems that Unicode support for PHP was first proposed in 2005 for what was planned to be PHP 6. Nine years later, and we’re just at 5.6.1. I came across this presentation on Slideshare from 2011 describing how the PHP+Unicode project reached a certain point and just ran out of steam. It seems nothing has happened since.

The nine years of bad history associated with the name “PHP 6” even has people suggesting that the next actual major release of PHP should be called “PHP 7”. It’s that bad.

Conclusion, for now

That PHP application I maintain is well over ten years old. It’s fairly stable, but has accumulated various bits of cruft over time. Adding new features is awkward and really it needs a rewrite. Since it uses lots of international characters I’d really like clean Unicode support, so I’m strongly drawn to using Python 3. It’s nearly 6 years old and supports Unicode properly. Now I’ve to pick a web framework. I’ll probably have a go with Django for now, simply because Harry’s TDD book uses it.

Oh and finally, just because I can, even though WordPress doesn’t want me to, here’s a goat: 🐐

Assuming you’ve got a font for it, of course!