Skip to content

[ruby] UTF-8 issues for :bytes fields #4228

@namxam

Description

@namxam

I have the following specification

Google::Protobuf::DescriptorPool.generated_pool.build do
  add_message "api.Mutation" do
    optional :set_json, :bytes, 1
  end
end
Mutation = Google::Protobuf::DescriptorPool.generated_pool.lookup("api.Mutation").msgclass

When I try to set a UTF-8 string like this Api::Mutation.new(set_json: 'Möp') it fails with ``initialize': U+00F6 from UTF-8 to ASCII-8BIT (Encoding::UndefinedConversionError)`.

Is this not supported or is it a bug? From what I have read, UTF-8 and ASCII Input should be fine for bytes.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions