-
Notifications
You must be signed in to change notification settings - Fork 2.7k
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
SmallRye OpenAPI outputs Chinese garbled characters in Json #44569
Comments
/cc @EricWittmann (openapi), @Ladicek (smallrye), @MikeEdgar (openapi), @jmartisk (smallrye), @phillip-kruger (openapi,smallrye), @radcortez (smallrye) |
Can you have a look at the |
@MorganMaohong There is no problem in my environment. |
Thank you for your reply. Can you provide me with a template project with smallrye-openApi extension so that I can test it in my local environment? Thank you very much! |
@MorganMaohong Here is a simple. |
@gsmet @yuhaibohotmail |
@gsmet This extension is very useful. I think it would be perfect if these configurations could be exposed and modified through configuration files. |
Which extension are you referring to @MorganMaohong ? |
@geoand In this extension, when I use the
|
But it sounds like it's an issue with your environment, no? |
@geoand Sorry, it is indeed my environment problem. The extension obtains the system encoding format. I would like to suggest a way to provide a configuration file to avoid this problem. It would be better if the extension uses utf-8 encoding by default. |
Let's see what @MikeEdgar thinks about that |
Thank you so much |
@MorganMaohong , I'm curious if you run |
@MikeEdgar,Thank you for reminding me. I think I understand why this happens. I checked the file in your way. The default UTF-8 encoding format in vs code is normal. When it is switched to Chinese GBK encoding format, it shows the same garbled characters as the /q/openapi interface. I downloaded the file in the dev interface and found that there was no suffix. After adding the suffix YAML or JSON, it was displayed as garbled characters. I guess that when the IO stream is written without setting the encoding format or the file without the suffix, the system default encoding format will be used. My computer is in the Chinese operating system environment, so it is GBK encoding format. So when I switched to Unicode encoding format, Chinese garbled characters will not appear.
quarkus-generated-openapi-doc.JSON
These are my speculations, please forgive me if there are any mistakes. |
The response will use UTF-8 in the Content-type regardless of how the OpenAPI doc is requested (suffix or not, Line 59 in 8df922d
|
@MikeEdgar,I switched the Windows language setting back to the Chinese environment, and then used curl and postman to do a test, but garbled characters still appeared. If I switched to unicode, no garbled characters would appear no matter what method I used. using curlUsing PostmanWindows Unicode beta testing feature |
@MorganMaohong does it happen with other endpoints in the application or just the OpenAPI response? For example, if you create a simple REST endpoint that returnes a |
@MikeEdgar According to what you said, I created a test REST request and it was normal. In addition, I used various REST tools to test and it was also normal. |
@MorganMaohong here's one more thing to try to understand where the problem is occurring. Create a |
@MikeEdgar I set up to load the static Then |
And just to confirm, you did that using the Chinese Windows environment, correct? |
@MikeEdgar Yes, I'm sure, I checked, |
Description
I downloaded a template project from the official website, added the SmallRey OpenAPI extension, added the @tag annotation to the Rest class, and used Chinese. When I accessed /q/openapi, the response was in garbled format. I guessed that the project was in UTF-8 format. Finally, I tried all the places where I could set the encoding format to UTF-8, but it still didn't match the Chinese display.
Implementation ideas
If you have any implementation ideas, they can go here, however please note that all design change proposals should be posted to the Quarkus developer mailing list (or the corresponding Google Group; see the decisions process document for more information. However, it is normal for the REST request response result to be displayed in Chinese.
Implementation ideas
No response
The text was updated successfully, but these errors were encountered: