smart quotes

A Scala method to replace a few “bad” characters

Here’s a little Scala method I wrote to replace some “bad” characters that won’t print properly on my Radio Pi display:

def replaceBadCharacters(s: String): String = {
    s.replaceAll("“", "\"")
     .replaceAll("”", "\"")
     .replaceAll("‘", "\"")
     .replaceAll("’", "\"")

There are other ways to solve this problem, but I threw this together as a quick patch until I can figure out why the Phosphor screen saver on the Raspberry Pi won’t print those characters that I’m replacing.

How to type smart quotes on Ubuntu Linux

Table of Contents1 - Background: Switching from MacOS to Ubuntu2 - Background: AltGr and Compose keys3 - Step 1: Figure out what the Compose key is4 - How to type smart quotes on Ubuntu (the hard way)5 - Note: You can stop here6 - Using Ubuntu macros to make it easier7 - Mapping keystrokes to xdotool commands8 - Summary

Note: I don’t know why, but all of the images for this article have been lost. I’ll replace them when I have some free time (but free time is scarce these days).

There seem to be a few different ways to type “smart quotes” on Ubuntu Linux, including using keys (keystrokes) like AltGr and Compose. In this tutorial I’ll document an approach that works best for me: creating macros I can assign to simple keystrokes rather than having to use more-complicated keystrokes.