square / wire

gRPC and protocol buffers for Android, Kotlin, Swift and Java.
https://square.github.io/wire/
Apache License 2.0
4.23k stars 572 forks source link

Fix UTF-32 BOM #2935

Closed aSemy closed 3 months ago

aSemy commented 3 months ago

The UTF-32 BOM is 0000feff, not 0000ffff

https://en.wikipedia.org/wiki/Byte_order_mark#Byte-order_marks_by_encoding

Noticed by @JakeWharton in kotlinlang Slack

See also: https://github.com/square/okhttp/pull/8403

oldergod commented 3 months ago

Thanks for the fix!, would you be able to sign our CLA so that I can merge the PR ?

This will be signed once and will apply for OkHttp as well.

oldergod commented 3 months ago
com.squareup.wire.schema.SchemaLoaderTest[jvm] > bomAwareLoading[jvm] FAILED
    java.lang.IllegalStateException: Syntax error in colors/squareup/colors/blue.proto:1:1: expected a word
        at com.squareup.wire.schema.internal.parser.SyntaxReader.unexpected(SyntaxReader.kt:424)
        at com.squareup.wire.schema.internal.parser.SyntaxReader.readWord(SyntaxReader.kt:456)
        at com.squareup.wire.schema.internal.parser.ProtoParser.readDeclaration(ProtoParser.kt:103)
        at com.squareup.wire.schema.internal.parser.ProtoParser.readProtoFile(ProtoParser.kt:69)
        at com.squareup.wire.schema.internal.parser.ProtoParser$Companion.parse(ProtoParser.kt:664)
        at com.squareup.wire.schema.RootsKt.parse(Roots.kt:66)
        at com.squareup.wire.schema.internal.CommonSchemaLoader.load(CommonSchemaLoader.kt:166)
        at com.squareup.wire.schema.internal.CommonSchemaLoader.loadSourcePathFiles$wire_schema(CommonSchemaLoader.kt:120)
        at com.squareup.wire.schema.SchemaLoaderTest.bomAwareLoading(SchemaLoaderTest.kt:332)
aSemy commented 3 months ago

Thanks for the fix!, would you be able to sign our CLA so that I can merge the PR ?

This will be signed once and will apply for OkHttp as well.

No thanks :)