Using special HTML characters in Elm

dwayne profile image Dwayne Crooks ・1 min read

NOTE: Works for Elm 0.19.

If you attempt to display the copyright symbol using the following:

view = text "©"

Then you'd literally see ©.

In order to get © you need to use Unicode escape characters.

view = text "\u{00A9}"

It's that simple.

If for any reason you mess up the escaping syntax (maybe you forget the curly braces, like a "friend" of mine did ;)) then Elm has your back with this insanely helpful error message.

Unicode escape characters error message

BTW, you can lookup the hex codes for what you need here.

P.S. I needed to figure this out when I had to output a non-breaking space in my Drum Machine project.

Posted on Aug 7 '19 by:

dwayne profile

Dwayne Crooks


A full stack web developer who has an interest in programming language theory, interpreters, compilers and type theory. I enjoy programming with Elm and Haskell in my free time.


markdown guide

Good stuff! It's little stuff like this that can easily turn into a source of fustration.


Thanks for the article!!! I had no idea you could do this in Elm