Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

compile warning about UTF-16 #784

Closed
emmenlau opened this issue Sep 1, 2015 · 5 comments
Closed

compile warning about UTF-16 #784

emmenlau opened this issue Sep 1, 2015 · 5 comments
Assignees

Comments

@emmenlau
Copy link

emmenlau commented Sep 1, 2015

I get the following compiler warning on Ubuntu 15.04:

Running com.google.protobuf.CodedOutputStreamTest
Aug 31, 2015 4:40:58 PM com.google.protobuf.CodedOutputStream writeStringNoTag
WARNING: Converting ill-formed UTF-16. Your Protocol Buffer will not round trip correctly!
com.google.protobuf.Utf8$UnpairedSurrogateException: Unpaired surrogate at index -1
    at com.google.protobuf.Utf8.encode(Utf8.java:460)
    at com.google.protobuf.CodedOutputStream.efficientWriteStringNoTag(CodedOutputStream.java:483)
[...]

Is this a problem? Can I do something to fix it? Thanks for your great work!

@xfxyjwf
Copy link
Contributor

xfxyjwf commented Sep 1, 2015

This error suggests your string fields contain invalid UTF-16 value and after converted to UTF-8 it will not contain the same value.

@emmenlau
Copy link
Author

emmenlau commented Sep 1, 2015

I'm sorry I should have been more explicit: I meant that I get this error from building your latest release. The compile does not fail, but when checking the logs I found this message. Its printed during the compile (or subsequent tests, I don't know). Do I do something wrong when compiling your release? Does it mean I configured wrongly?

@xfxyjwf
Copy link
Contributor

xfxyjwf commented Sep 1, 2015

No, it's fine. We have tests to verify the behavior when invalid UTF-16 string is encountered and that's why you see these warning when building protobuf. You can safely ignore them.

@emmenlau
Copy link
Author

emmenlau commented Sep 1, 2015

Thanks! Ignoring the issue, and closing as "won't fix"!

@emmenlau emmenlau closed this as completed Sep 1, 2015
@emmenlau emmenlau reopened this Sep 26, 2016
@emmenlau
Copy link
Author

Actually the behavior is still a bit unfortunate... I have just spent another hour to figure out why I get this warning during the protobuf-java compile, just to find my own issue here, from one year ago! Do you think it would be possible that the tests run without throwing this exception? I think many users must be scared to run the tests and see exceptions being thrown...
Thanks a lot for your consideration!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants