# Should identifiers be quoted when using characters from the “Miscellaneous Symbols and Pictographs” unicode block?

**URL:** <https://forum.graphviz.org/t/should-identifiers-be-quoted-when-using-characters-from-the-miscellaneous-symbols-and-pictographs-unicode-block/2018>\
**Category:** Help\
**Created:** [February 12, 2024, 6:11pm UTC](https://forum.graphviz.org/t/should-identifiers-be-quoted-when-using-characters-from-the-miscellaneous-symbols-and-pictographs-unicode-block/2018 "2024-02-12T18:11:08Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![magjac](https://sea2.discourse-cdn.com/graphviz/user_avatar/forum.graphviz.org/magjac/32/16_2.png) [@magjac](https://forum.graphviz.org/u/magjac)\
**Post date:** [February 12, 2024, 6:11pm UTC](https://forum.graphviz.org/t/should-identifiers-be-quoted-when-using-characters-from-the-miscellaneous-symbols-and-pictographs-unicode-block/2018/1 "2024-02-12T18:11:08Z")

</div>

Apparently this renders fine, but is it legal DOT?  
[dot verbose=true]

```auto
digraph G {
  charset="UTF-8"
  🍔 -> 💩
}

```

[/dot]

I assumed that I would have had to write this with quotes, like so:  
[dot verbose=true]

```auto
digraph G {
  charset="UTF-8"
  "🍔"-> "💩"
}

```

[/dot]

The [DOT spec](https://graphviz.org/doc/info/lang.html) has this to say:

> An ID is one of the following:
> 
> - Any string of alphabetic ([a-zA-Z\200-\377]) characters, underscores (‘\_’) or digits([0-9]), not beginning with a digit;  
> …

I’m not sure how to interpret `\200-\377` in this context since “DOT assumes the [UTF-8](https://en.wikipedia.org/wiki/UTF-8) character encoding”. Does it mean the [Unicode Block “Latin-1 Supplement”](https://www.compart.com/en/unicode/block/U+0080)? That seems odd, but seems also to work:

[dot verbose=true]

```auto
digraph G {
  charset="UTF-8"
  ¨ -> ¸
}

```

[/dot]

Surely it cannot mean the first byte of an UTF-8 sequence?

The reason I’m asking is because of this Graphviz Visual Editor issue:

> <https://github.com/magjac/graphviz-visual-editor/issues/187>
>
> There's a sample linked from the documentation:
> 
> http://magjac.com/graphviz-vi…sual-editor/?dot=digraph%20G%20%7b%0a%20%20charset%3d%22UTF-8%22%0a%20%20%f0%9f%8d%94%20-%3e%20%f0%9f%92%a9%0a%7d
> 
> which immediately raises an error, even though as part of the official documentation, that should probably work.

Since it was written, we have changed the [example in the official documentation](https://graphviz.org/doc/info/attrs.html#d:charset) through this commit:

> **[Update charset.md: quote example so it runs in playground (a34f4a64) · Commits...](https://gitlab.com/graphviz/graphviz.gitlab.io/-/commit/a34f4a645b27f8a7b8b60195a7e92ff94917a204)**
>
> Graphviz web site - graphviz.org

---

<div class="post-metadata">

**Author:** ![scnorth](https://sea2.discourse-cdn.com/graphviz/user_avatar/forum.graphviz.org/scnorth/32/89_2.png) [@scnorth](https://forum.graphviz.org/u/scnorth)\
**Post date:** [February 13, 2024, 1:02pm UTC](https://forum.graphviz.org/t/should-identifiers-be-quoted-when-using-characters-from-the-miscellaneous-symbols-and-pictographs-unicode-block/2018/2 "2024-02-13T13:02:54Z")

</div>

I don’t know, and I don’t think anyone knows, but the answer is in lib/cgraph/scan.l, which includes this:

```auto
LETTER [A-Za-z_\200-\377]
DIGIT [0-9]
NAME {LETTER}({LETTER}|{DIGIT})*
NUMBER [-]?(({DIGIT}+(\.{DIGIT}*)?)|(\.{DIGIT}+))(\.|{LETTER})?
ID ({NAME}|{NUMBER})

```

There’s other code that handles the case of quoted strings. Also HTML strings. Inside quoted strings, the lexer just soaks up ` ([^"\\\n]*|[\\])` until it sees `["]`.

There’s no awareness of charset settings or anything like that.

When this was written, not much though was given to anything except ASCII. It appears we just noticed, hey, if we define LETTER to include \200-\377, we can process UTF-8. Hold my beer…
