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

Format string error in LangTags #2971

Closed
wants to merge 1 commit into from
Closed

Format string error in LangTags #2971

wants to merge 1 commit into from

Conversation

hoijui
Copy link
Contributor

@hoijui hoijui commented Jan 22, 2025

%c requires a char, but a String was supplied.

For more details, see here:
https://docs.oracle.com/javase/8/docs/api/java/util/Formatter.html#syntax


By submitting this pull request, I acknowledge that I am making a contribution to the Apache Software Foundation under the terms and conditions of the Contributor's Agreement.

`%c` requires a `char`, but a `String` was supplied.

For more details, see here:
<https://docs.oracle.com/javase/8/docs/api/java/util/Formatter.html#syntax>
@afs
Copy link
Member

afs commented Jan 22, 2025

Hi @hoijui

The function str(char) takes the char and returns a string of the quoted character together with its Unicode codepoint.

  private static String str(char ch) {
        return String.format("'%s' U+%04X", Character.valueOf(ch), (int)ch);
    }

so the bug is that the %c should be %s.

@hoijui
Copy link
Contributor Author

hoijui commented Jan 23, 2025

Ahh thank you!
I was wondering which of the two ways to change this would be right. should have had a look at str(char).
Opened a new PR.

@hoijui hoijui closed this Jan 23, 2025
@afs
Copy link
Member

afs commented Jan 23, 2025

No problem - I had to check the code to work out how it got in that state. Putting in a formatted string with codepoint, not %c is a late addition.

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

Successfully merging this pull request may close these issues.

None yet

2 participants