Uploaded image for project: 'Erlang/OTP'
  1. Erlang/OTP
  2. ERL-1466

erl_prettypr:format/2 with utf8 encoding provides invalid binary literal strings

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Open
    • Priority: Major
    • Resolution: Unresolved
    • Affects Version/s: None
    • Fix Version/s: None
    • Component/s: syntax_tools
    • Labels:
      None

      Description

      Was using Erlang/OTP 23.2.3 and Elixir 1.11.3 with https://github.com/okeuday/reltool_util/blob/master/ex2erl to discover this problem. I had expected that erl_prettypr:format/2 would provide valid utf8 output when it is given the encoding option utf8. However, with binary literal strings in the syntax tree that are invalid utf8, the output will fail compilation due to the output being invalid utf8.

      So, a syntax tree that contains a binary like:

      <<"½EÇ+\2031\\\006\027\031Ò¯K©AÓ">>
      

      will not be formatted as:

      <<189,69,199,43,131,49,92,6,23,25,210,175,75,169,65,211>>
      

      for valid utf8 compilation.

        Attachments

          Activity

            People

            Assignee:
            otp_team_vm Team VM
            Reporter:
            okeuday Michael Truog
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Dates

              Created:
              Updated: