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

Use upload_style to add a style Chinese garbled #158

Open
mengqiuzl opened this issue Jul 23, 2024 · 4 comments
Open

Use upload_style to add a style Chinese garbled #158

mengqiuzl opened this issue Jul 23, 2024 · 4 comments
Labels
bug Something isn't working question Further information is requested

Comments

@mengqiuzl
Copy link

mengqiuzl commented Jul 23, 2024

I'm using the upload_style method in the geoserver-rest api to add a new style, and my sld file contains Chinese fields, and after adding it, Chinese garbled characters.
Here are my sld files:
县.zip
image

@iamtekson
Copy link
Collaborator

Have you got any issues after uploading? If you have the error message, please attach it too.

@iamtekson iamtekson added the question Further information is requested label Jul 23, 2024
@mengqiuzl
Copy link
Author

mengqiuzl commented Jul 24, 2024

from geo.Geoserver import Geoserver

geo = Geoserver(
    "http://localhost:8089/geoserver", username="admin", password="geoserver"
)
geo.upload_style(
    path="style/县.sld",
    name="teststyle123",
    workspace="mengqiu",
    sld_version="1.1",
)

The SLD file I uploaded is encoded in UTF-8, but the Chinese garbled code is cleared in the style, similar to this:
This is the source file:
屏幕截图 2024-07-24 084807
This is after uploading:
屏幕截图 2024-07-24 084458

@iamtekson
Copy link
Collaborator

It looks weird. Have you tried directly uploading the SLD to the geoserver? Also, it is better to check the geoserver log file. I have no idea about this issue.

@mengqiuzl
Copy link
Author

Manually add the style file and save it to the geoserver, if the sld file has Chinese, the file encoding will change to GB2312, if there is no Chinese file encoding will be uft-8. Upload the sld file via geoserver-rest, no matter what encoding format the sld file, it will be saved as uft-8 after uploading, here the sld file encoding containing Chinese is not changed to GB2312, this is the main reason for the garbled Chinese, is there any way you can solve this problem? Thank you very much.

@iamtekson iamtekson added the bug Something isn't working label Jul 25, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants