UnicodeSmuggler

View Source

Because it seemed like a good idea at the time, this is a quick implementation of the ideas in Paul Butler's blog post Smuggling arbitrary data through an emoji as a small Elixir package.

UnicodeSmuggler is a simple stenography utility that will hide text by attaching it to any Unicode character as a list of invisible "variation selectors". The character will render as normal in most unicode-compatible applications. UnicodeSmuggler (or anything else compatible with Paul Butler's code) can later be used to extract the hidden text.

As Paul makes clear this is, at best, an underhand hack and misuse of the Unicode standard. On the other hand, it's an interesting trick, I thought it would be fun to implement, and this library may possibly be of use for detecting such tricks in the wild.

Features

  • Encode text in a Unicode character
  • Decode text hidden in a Unicode character
  • Find hidden text in a string
  • Remove hidden text from a Unicode character
  • Accidentally confuse JetBrains' IDEs like RubyMine and cause mysterious problems in your own tests
  • Ducks

Examples

Encoding

  UnicodeSmuggler.encode!("Aw yiss!")
  # => "đŸŠ†ó „±ó …§ó „ó …©ó …™ó …Łó …Ł"

Decoding

  UnicodeSmuggler.decode!("đŸŠ†ó „±ó …§ó „ó …©ó …™ó …Łó …Ł")
  # => "Aw yiss!"

Trimming

  UnicodeSmuggler.trim("đŸŠ†ó „±ó …§ó „ó …©ó …™ó …Łó …Ł")
  |> UnicodeSmuggler.decode!()
  # => nil

Installation

If available in Hex, the package can be installed by adding unicode_smuggler to your list of dependencies in mix.exs:

def deps do
  [
    {:unicode_smuggler, "~> 0.1.0"}
  ]
end

Documentation

Documentation can be generated with ExDoc and published on HexDocs. Once published, the docs can be found at https://hexdocs.pm/unicode_smuggler.

Contributing

You can request new features by creating an issue, or submit a pull request with your contribution.

Copyright (c) 2025 Pete Birkinshaw

UnicodeSmuggler is MIT licensed.

Disclaimer

Use at your own risk