Skip to content

Encoding error during compilation depends on .proto filename #420

@rpinmanc

Description

@rpinmanc

Hello. I'm experiencing a very strange error and I can't figure out where it's coming from.

When compiling a proto file named 'n1_n2.proto', I get an encoding error:

$> protoc --elixir_out=gen_descriptors=true:compiled_protos n1_n2.proto
** (RuntimeError) reading from :stdio failed: {:error, {:no_translation, :unicode, :latin1}}
    (protobuf 0.15.0) lib/protobuf/protoc/cli.ex:234: Protobuf.Protoc.CLI.binread_all!/1
  
    (protobuf 0.15.0) lib/protobuf/protoc/cli.ex:45: Protobuf.Protoc.CLI.main/1
    (elixir 1.18.2) lib/kernel/cli.ex:137: anonymous fn/3 in Kernel.CLI.exec_fun/2
--elixir_out: protoc-gen-elixir: Plugin failed with status code 1.

But if I rename the same file to 'n1_n2_conv.proto', it compiles successfully:

$> mv n1_n2.proto n1_n2_conv.proto
$> protoc --elixir_out=gen_descriptors=true:compiled_protos n1_n2_conv.proto

Other names also produce the same error: 'An1_n2.proto', 'n1_n2A.proto', 'n1n2.proto'.

Compile the proto to java does not fail:

$> protoc --java_out=compiled_protos n1_n2.proto

Right now, I have a workaround by renaming it to 'n1_n2_conv.proto', but this is a very strange error.

Thanks for your great work.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions