Show warning when UnicodeEncodeError is raised #178
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Show warning when
UnicodeEncodeErroris raised.To test, on Windows go to Control Panel > Region > Administrative > Change system local and use English. Do not check Beta: Use Unicode UTF-8 for worldwide language support.
Open PowerShell terminal and run
az group show -n testrg { "id": "/subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/resourceGroups/testrg", "location": "centralus", "managedBy": null, "name": "testrg", "properties": { "provisioningState": "Succeeded" }, "tags": { "key0303": "测试€£¥テスト안녕𓀀𓀁𒀉𒅤" }, "type": "Microsoft.Resources/resourceGroups" }The output is correct, but if the output is redirected, PowerShell uses the system encoding. Thus
azwill silently remove the value ofkey0303:> $t = az group show -n testrg > $t { "id": "/subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/resourceGroups/testrg", "location": "centralus", "managedBy": null, "name": "testrg", "properties": { "provisioningState": "Succeeded" }, "tags": { "key0303": "" // value is removed }, "type": "Microsoft.Resources/resourceGroups" }The solution is any of
If none of the above solution is adopted, Knack will show a warning: