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

Add the SILKY_JSON_ENSURE_ASCII configuration item to support Chinese #420

Merged
merged 5 commits into from
Nov 3, 2020

Conversation

eshxcmhk
Copy link
Contributor

Support for users to configure the SILKY_JSON_ENSURE_ASCII parameter to implement json.dumps support Chinese

Copy link
Member

@nasirhjafri nasirhjafri left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you add a new tests which sets this settings to false?

@eshxcmhk
Copy link
Contributor Author

Could you add a new tests which sets this settings to false?

I'm sorry, but as a python novice, I don't really know how to add this feature. Also, I don't have time to do this right now, but it works fine on my project

@nasirhjafri
Copy link
Member

Feel free to do it when you have time. Use this decorator to override settings for a test. https://docs.djangoproject.com/en/dev/topics/testing/tools/#overriding-settings

@@ -28,7 +28,8 @@ class SilkyConfig(metaclass=Singleton):
'SILKY_PYTHON_PROFILER': False,
'SILKY_PYTHON_PROFILER_FUNC': None,
'SILKY_STORAGE_CLASS': 'silk.storage.ProfilerResultStorage',
'SILKY_MIDDLEWARE_CLASS': 'silk.middleware.SilkyMiddleware'
'SILKY_MIDDLEWARE_CLASS': 'silk.middleware.SilkyMiddleware',
'SILKY_JSON_ENSURE_ASCII': True,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Chinese don't work as Unicode?

Copy link
Contributor Author

@eshxcmhk eshxcmhk Nov 3, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Chinese don't work as Unicode?

The Chinese characters are shown below on the page:

"\u8be5\u8f66\u5728\u3010\u53e4\u853a\u5b8f\u6c38\u3011\u68c0\u6d4b\u672a\u5b8c\u6210\uff0c\u65e0\u6cd5\u767b\u5f55"

Not easy to read.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

did you encoded your chinease as utf-8?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

did you encoded your chinease as utf-8?

Yes, the http request send with utf-8 encode

@auvipy auvipy merged commit 913699a into jazzband:master Nov 3, 2020
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

3 participants