double 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.