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

Update win_command and win_shell add output_encoding_override example #658

Merged
merged 4 commits into from
Oct 31, 2024

Conversation

j796160836
Copy link
Contributor

@j796160836 j796160836 commented Sep 13, 2024

SUMMARY

Update win_command.py and win_shell.py add output_encoding_override example
I'm fixing ansible output encoding issue recently. During google search and ai answers which is not accurate.
Adding some example and trying to complete manual.

ISSUE TYPE
  • Docs Pull Request
COMPONENT NAME
  • ansible.windows.win_command module
  • ansible.windows.win_shell module
ADDITIONAL INFORMATION

Some related issue
ansible/ansible#54896
ansible/ansible#54966

Add `output_encoding_override` examples to clarify the manual
Add `output_encoding_override` examples to clarify the manual
plugins/modules/win_command.py Outdated Show resolved Hide resolved
@@ -115,6 +115,11 @@
ansible.windows.win_shell: C:\somescript.ps1
args:
no_profile: true

- name: Run a PowerShell script with big5 encoding (fixing garbled text issue)
Copy link
Collaborator

Choose a reason for hiding this comment

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

I'm not sure there is really a need to document this for win_shell. PowerShell will be using the existing console encoding which we set to utf-8. Any executable that the .ps1 script will call is subject to the encoding rules of PowerShell itself and shouldn't affect the output_encoding_override unless the script itself changes the [Console]::OutputEncoding.

Copy link
Contributor Author

@j796160836 j796160836 Oct 3, 2024

Choose a reason for hiding this comment

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

I'm a user for Taiwan, using Traditional Chinese.
Tested using RHEL 9.4 as control nodes and Windows 2012 R2 as managed nodes.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Screenshot 2024-10-03 at 8 27 34 AM

Copy link
Collaborator

Choose a reason for hiding this comment

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

Thanks for sharing, I think this is the case because keytool will be writing directly to the console and not going through PowerShell's string encoding. Appreciate you sharing this use case as I wasn't aware that would have been a problem.

j796160836 and others added 2 commits October 2, 2024 05:55
Co-authored-by: Jordan Borean <jborean93@gmail.com>
unified descriptions
@jborean93 jborean93 merged commit 8fce4f7 into ansible-collections:main Oct 31, 2024
30 checks passed
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.

2 participants