Title: ElementTree should use UTF-8 for xml declaration. · Issue #91810 · python/cpython · GitHub
Open Graph Title: ElementTree should use UTF-8 for xml declaration. · Issue #91810 · python/cpython
X Title: ElementTree should use UTF-8 for xml declaration. · Issue #91810 · python/cpython
Description: Feature or enhancement Currently, ElementTree.tostring(root, encoding="unicode", xml_declaration=True) uses locale encoding. I think ElementTree should use UTF-8, instead of locale encoding. Example: $ LANG=ja_JP.eucJP ./python.exe Pytho...
Open Graph Description: Feature or enhancement Currently, ElementTree.tostring(root, encoding="unicode", xml_declaration=True) uses locale encoding. I think ElementTree should use UTF-8, instead of locale encoding. Exampl...
X Description: Feature or enhancement Currently, ElementTree.tostring(root, encoding="unicode", xml_declaration=True) uses locale encoding. I think ElementTree should use UTF-8, instead of locale encodi...
Opengraph URL: https://github.com/python/cpython/issues/91810
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"ElementTree should use UTF-8 for xml declaration.","articleBody":"**Feature or enhancement**\r\n\r\nCurrently, `ElementTree.tostring(root, encoding=\"unicode\", xml_declaration=True)` uses locale encoding.\r\n\r\nI think ElementTree should use UTF-8, instead of locale encoding.\r\n\r\n\r\nExample:\r\n\r\n```pycon\r\n$ LANG=ja_JP.eucJP ./python.exe\r\nPython 3.11.0a7+ (heads/bytes-alloc-dirty:7fbc7f6128, Apr 19 2022, 16:53:54) [Clang 12.0.0 (clang-1200.0.32.29)] on darwin\r\nType \"help\", \"copyright\", \"credits\" or \"license\" for more information.\r\n\u003e\u003e\u003e import xml.etree.ElementTree as ET\r\n\u003e\u003e\u003e et = ET.fromstring(\"\u003ct\u003ehello\u003c/t\u003e\")\r\n\u003e\u003e\u003e ET.tostring(et, encoding=\"unicode\", xml_declaration=True)\r\n\"\u003c?xml version='1.0' encoding='eucJP'?\u003e\\n\u003ct\u003ehello\u003c/t\u003e\"\r\n```\r\n\r\nCode:\r\n\r\nhttps://github.com/python/cpython/blob/bcf14ae4336fced718c00edc34b9191c2b48525a/Lib/xml/etree/ElementTree.py#L732-L742\r\n\r\n**Pitch**\r\n\r\n* UTF-8 is the most common encoding for XML.\r\n* Locale encoding name (e.g. `cp932` or `eucJP`) would be different from XML encoding name recommended by w3c (e.g. `Shift_JIS` or `EUC-JP`).\r\n","author":{"url":"https://github.com/methane","@type":"Person","name":"methane"},"datePublished":"2022-04-22T07:23:56.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":10},"url":"https://github.com/91810/cpython/issues/91810"}
| 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:7f0bb3c4-def5-de43-00c9-d54bdb7cdb3d |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | 9904:994E3:383C2D:4BED67:6969AD10 |
| html-safe-nonce | 39d8aa218532061032152028a5587cc072bcca085dc1483f9d2de36e4b3287dd |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI5OTA0Ojk5NEUzOjM4M0MyRDo0QkVENjc6Njk2OUFEMTAiLCJ2aXNpdG9yX2lkIjoiMzUxMDM4MTc1ODk2OTkxNjY4OCIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | de5a6515572e5b1b9ed4c073312c0ca7c083495a4d5c5947dfe0b3a2f33f9802 |
| hovercard-subject-tag | issue:1211931511 |
| 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/python/cpython/91810/issue_layout |
| twitter:image | https://opengraph.githubassets.com/d5ab338bee838d2313b95e89edf8e894a002a8ecb3270afe5b35848494df005a/python/cpython/issues/91810 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/d5ab338bee838d2313b95e89edf8e894a002a8ecb3270afe5b35848494df005a/python/cpython/issues/91810 |
| og:image:alt | Feature or enhancement Currently, ElementTree.tostring(root, encoding="unicode", xml_declaration=True) uses locale encoding. I think ElementTree should use UTF-8, instead of locale encoding. Exampl... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | methane |
| hostname | github.com |
| expected-hostname | github.com |
| None | 24c4c97a2d520cb286b35e1a4c22d7a4df3c26a2fa28dd7cdf0e65db327b4de7 |
| turbo-cache-control | no-preview |
| go-import | github.com/python/cpython git https://github.com/python/cpython.git |
| octolytics-dimension-user_id | 1525981 |
| octolytics-dimension-user_login | python |
| octolytics-dimension-repository_id | 81598961 |
| octolytics-dimension-repository_nwo | python/cpython |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 81598961 |
| octolytics-dimension-repository_network_root_nwo | python/cpython |
| 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 | 124667f43168afb6c9c03b7c02eb5b1d2e1be3d9 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width