Skip to content

Invalid Unicode in unquoted atom #15419

@RaymondLoranger

Description

@RaymondLoranger

Existing issue

  • I have searched existing issues and could not find a duplicate.

Elixir and Erlang/OTP versions

Erlang/OTP 28 [erts-16.3] [source] [64-bit] [smp:8:8] [ds:8:8:10] [async-threads:1] [jit:ns]

Interactive Elixir (1.19.5) - press Ctrl+C to exit (type h() ENTER for help)

Operating system

Windows 10

Current behavior

When I compile hex package io_ansi_plus, I get error “Codepoint failed”. Why? and why are the “Got:” and “Hint:” codepoints identical? It seems in an unquoted atom that Pinyin character ǜ (Latin Small Letter U with diaeresis and grave) is invalid. However Pinyin character ǔ (Latin Small Letter U with caron) is valid. I am using Elixir v1.19.5 when getting this error. In version v1.18, the same source code compiled fine! Here is the error:

mix compile
Compiling 2 files (.ex)

== Compilation error in file lib/io/ansi/plus/ie.ex ==
** (SyntaxError) invalid syntax found on config/persist_colors.exs:2323:13:
error: unexpected token: Codepoint failed identifier tokenization, but a simpler form was found.

  Got:

      "cōng_lǜ" (code points 0x00063 0x0014D 0x0006E 0x00067 0x0005F 0x0006C 0x001DC)

  Hint: You could write the above in a similar way that is accepted by Elixir:

      "cōng_lǜ" (code points 0x00063 0x0014D 0x0006E 0x00067 0x0005F 0x0006C 0x001DC)

  See https://hexdocs.pm/elixir/unicode-syntax.html for more information.
  │

2323 │ :cōng_lǜ_green,
│ ^

└─ config/persist_colors.exs:2323:13
(elixir 1.19.5) lib/code.ex:628: Code.validated_eval_string/3
(elixir 1.19.5) lib/config.ex:326: Config.eval!/3
(elixir 1.19.5) lib/config/reader.ex:102: Config.Reader.read!/2
lib/io/ansi/plus/ie.ex:4: anonymous fn/1 in :elixir_compiler_2.MODULE/1
(elixir 1.19.5) lib/enum.ex:961: Enum."-each/2-lists^foreach/1-0-"/2
lib/io/ansi/plus/ie.ex:4: (module)

Expected behavior

Unquoted atom :cōng_lǜ_green should be valid.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No fields configured for Bug.

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions