Skip to content

Mermaid cannot parse unicode characters #1877

Description

@denilsonsa

The currently deployed mermaid version on https://stackedit.io/app barfs if the mermaid source-code contains non-latin unicode characters.

Plain ASCII works

```mermaid
flowchart TD
    src([packages/.../*.js]) --> eyes((eyes))
```
flowchart TD
    src([packages/.../*.js]) --> eyes((eyes))
Loading

U+2026 Unicode character fails

But U+2026 : HORIZONTAL ELLIPSIS breaks the mermaid parser in stackedit:

Error: Lexical error on line 2. Unrecognized text.
...D    src([packages/…/*.js]) --> eyes((e
----------------------^
```mermaid
flowchart TD
    src([packages/…/*.js]) --> eyes((eyes))
```
flowchart TD
    src([packages/…/*.js]) --> eyes((eyes))
Loading

Emoji character also fails

The same if we use emoji, such as U+1F440 : EYES:

Error: Lexical error on line 2. Unrecognized text.
...../*.js]) --> eyes((👀))
-----------------------^
```mermaid
flowchart TD
    src([packages/.../*.js]) --> eyes((👀))
```
flowchart TD
    src([packages/.../*.js]) --> eyes((👀))
Loading

Screenshot

Image

Related work

This is potentially related to #1838.

And, of course, these examples work just fine here in GitHub and also in mermaid-js.github.io/mermaid-live-editor/

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions