Title: Exceptions when using cz from ISO8859-1 Terminal · Issue #956 · commitizen-tools/commitizen · GitHub
Open Graph Title: Exceptions when using cz from ISO8859-1 Terminal · Issue #956 · commitizen-tools/commitizen
X Title: Exceptions when using cz from ISO8859-1 Terminal · Issue #956 · commitizen-tools/commitizen
Description: Description When issuing 'cz info' from a ISO8859-1 encoded Terminal I get the following exception: [xx@XXXXXX:~/tmp/test-git-repo (master +)] $ cz info Traceback (most recent call last): File "/home/user/pb/venv_commitizen/bin/cz", line...
Open Graph Description: Description When issuing 'cz info' from a ISO8859-1 encoded Terminal I get the following exception: [xx@XXXXXX:~/tmp/test-git-repo (master +)] $ cz info Traceback (most recent call last): File "/ho...
X Description: Description When issuing 'cz info' from a ISO8859-1 encoded Terminal I get the following exception: [xx@XXXXXX:~/tmp/test-git-repo (master +)] $ cz info Traceback (most recent call last): F...
Opengraph URL: https://github.com/commitizen-tools/commitizen/issues/956
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Exceptions when using cz from ISO8859-1 Terminal","articleBody":"### Description\n\nWhen issuing 'cz info' from a ISO8859-1 encoded Terminal I get the following exception:\r\n\r\n```\r\n[xx@XXXXXX:~/tmp/test-git-repo (master +)] $ cz info\r\nTraceback (most recent call last):\r\n File \"/home/user/pb/venv_commitizen/bin/cz\", line 8, in \u003cmodule\u003e\r\n sys.exit(main())\r\n ^^^^^^\r\n File \"/home/user/pb/venv_commitizen/lib/python3.11/site-packages/commitizen/cli.py\", line 570, in main\r\n args.func(conf, arguments)()\r\n File \"/home/user/pb/venv_commitizen/lib/python3.11/site-packages/commitizen/commands/info.py\", line 13, in __call__\r\n out.write(self.cz.info())\r\n File \"/home/user/pb/venv_commitizen/lib/python3.11/site-packages/commitizen/out.py\", line 13, in write\r\n print(value, *args)\r\nUnicodeEncodeError: 'latin-1' codec can't encode character '\\u2019' in position 1068: ordinal not in range(256)\r\n```\r\n\r\nI was running into that problem on MacOS (Ventura 13.6.3) and AlmaLinux 8.9.\r\n\r\nSame exception also happens when issuing 'cz init' quite at the end of the process:\r\n```\r\n[xx@xxxxxxxx:~/tmp/test-git-repo (master +)] $ cz init\r\nWelcome to commitizen!\r\n\r\nAnswer the questions to configure your project.\r\nFor further configuration visit:\r\n\r\nhttps://commitizen-tools.github.io/commitizen/config/\r\n\r\n? Please choose a supported config file: .cz.toml\r\n? Please choose a cz (commit rule): (default: cz_conventional_commits) cz_conventional_commits\r\n? Choose the source of the version: commitizen: Fetch and set version in commitizen config (default)\r\nNo Existing Tag. Set tag to v0.0.1\r\n? Choose version scheme: semver\r\n? Please enter the correct version format: (default: \"$version\")\r\n? Create changelog automatically on bump Yes\r\n? Keep major version zero (0.x) during breaking changes Yes\r\n? What types of pre-commit hook you want to install? (Leave blank if you don't want to install) done\r\n\r\nYou can bump the version running:\r\n\r\n\tcz bump\r\n\r\nTraceback (most recent call last):\r\n File \"/home/user/pb/venv_commitizen/bin/cz\", line 8, in \u003cmodule\u003e\r\n sys.exit(main())\r\n ^^^^^^\r\n File \"/home/user/pb/venv_commitizen/lib/python3.11/site-packages/commitizen/cli.py\", line 570, in main\r\n args.func(conf, arguments)()\r\n File \"/home/user/pb/venv_commitizen/lib/python3.11/site-packages/commitizen/commands/init.py\", line 150, in __call__\r\n out.success(\"Configuration complete \\U0001f680\")\r\n File \"/home/user/pb/venv_commitizen/lib/python3.11/site-packages/commitizen/out.py\", line 28, in success\r\n line(message)\r\n File \"/home/user/pb/venv_commitizen/lib/python3.11/site-packages/commitizen/out.py\", line 18, in line\r\n print(value, *args, **kwargs)\r\nUnicodeEncodeError: 'latin-1' codec can't encode character '\\U0001f680' in position 28: ordinal not in range(256)\r\n```\r\n\r\nThis probably happens also with other non UTF-8 encoded Terminals. \r\n\r\nWe have quite a few machines that still run (due to the application running on them) in ISO8859-1 Encoding\n\n### Steps to reproduce\n\n1. Start new Terminal\r\n2. Set LANG to 'de_CH.ISO8859-1' with 'export LANG=de_CH.ISO8859-1'\r\n3. issue 'cz info'\n\n### Current behavior\n\nException / Crash\n\n### Desired behavior\n\noptimum:\r\nProper output with reencoding also with other Terminal Encodings than UTF-8. (This is due the fact that we have to use ISO8859-1 Terminal for development and therefore also use git and cz inside these terminals)\r\n\r\nAcceptable but not desireable:\r\nPrevent cz from being used with non UTF-8 Termial: warn and exit at start instead of throwing an exception in the middle of the work.\n\n### Screenshots\n\n_No response_\n\n### Environment\n\ncz version --report\r\nCommitizen Version: 3.13.0\r\nPython Version: 3.11.6 (main, Oct 3 2023, 17:06:54) [GCC 8.5.0 20210514 (Red Hat 8.5.0-18)]\r\nOperating System: Linux","author":{"url":"https://github.com/keenonkites","@type":"Person","name":"keenonkites"},"datePublished":"2024-01-09T07:42:22.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":6},"url":"https://github.com/956/commitizen/issues/956"}
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:8052a9d5-c59b-6842-1103-bcc6ca76a027 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | C16E:1BDC7:404CCD:587935:6A4DC61B |
| html-safe-nonce | 62be1753cca2e6ae5a2a5d4efb0a6caeb4135018784062d6e214a82a8ddb3526 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJDMTZFOjFCREM3OjQwNENDRDo1ODc5MzU6NkE0REM2MUIiLCJ2aXNpdG9yX2lkIjoiNjU4MDEwMTE2MDEwNjgzNzUzMSIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | 3e2de4992daa3493a9835138b4c8493d7c33955352ce9adf559f505809e81632 |
| hovercard-subject-tag | issue:2071803739 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/commitizen-tools/commitizen/956/issue_layout |
| twitter:image | https://opengraph.githubassets.com/abfaaf40c943badd75cf4d47972d1f3ef1ddc99e4d17cb5052996d6c2ae2401b/commitizen-tools/commitizen/issues/956 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/abfaaf40c943badd75cf4d47972d1f3ef1ddc99e4d17cb5052996d6c2ae2401b/commitizen-tools/commitizen/issues/956 |
| og:image:alt | Description When issuing 'cz info' from a ISO8859-1 encoded Terminal I get the following exception: [xx@XXXXXX:~/tmp/test-git-repo (master +)] $ cz info Traceback (most recent call last): File "/ho... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | keenonkites |
| hostname | github.com |
| expected-hostname | github.com |
| None | 06b8a6144231bf3a234f1c2e9993861e07ce98a905912b114aa386c2d7e84b33 |
| turbo-cache-control | no-preview |
| go-import | github.com/commitizen-tools/commitizen git https://github.com/commitizen-tools/commitizen.git |
| octolytics-dimension-user_id | 62252524 |
| octolytics-dimension-user_login | commitizen-tools |
| octolytics-dimension-repository_id | 106127589 |
| octolytics-dimension-repository_nwo | commitizen-tools/commitizen |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 106127589 |
| octolytics-dimension-repository_network_root_nwo | commitizen-tools/commitizen |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 1d344bdb7547fe6bca17a59bb2b8aac3dc9532a0 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width