Title: GitHub · Where software is built
Open Graph Title: pythonnet/pythonnet
X Title: pythonnet/pythonnet
Description: Python for .NET is a package that gives Python programmers nearly seamless integration with the .NET Common Language Runtime (CLR) and provides a powerful application scripting tool for .NET developers. - pythonnet/pythonnet
Open Graph Description: Python for .NET is a package that gives Python programmers nearly seamless integration with the .NET Common Language Runtime (CLR) and provides a powerful application scripting tool for .NET develo...
X Description: Python for .NET is a package that gives Python programmers nearly seamless integration with the .NET Common Language Runtime (CLR) and provides a powerful application scripting tool for .NET develo...
Opengraph URL: https://github.com/pythonnet/pythonnet
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Possible bug in reading zero width no-break space character","articleBody":"### Environment\r\n\r\n- Pythonnet version: 3.0.3\r\n- Python version: 3.10\r\n- Operating System: Windows 11\r\n- .NET Runtime: 8.0.4\r\n\r\n### Details\r\n\r\n- Describe what you were trying to get done.\r\n\r\nI want to read a file that may contain zero width no-break space characters anywhere in the file. If I read a file using C# into Python using Python.NET, these characters get dropped if they are at the start of a line.\r\n\r\n- What commands did you run to trigger this issue? If you can provide a\r\n [Minimal, Complete, and Verifiable example](http://stackoverflow.com/help/mcve)\r\n this will help us understand the issue.\r\n\r\n```python\r\nfrom pythonnet import load\r\nload(\"coreclr\")\r\nimport clr\r\nclr.AddReference('System')\r\nclr.AddReference('System.Runtime')\r\nclr.AddReference('System.IO')\r\n\r\nimport System\r\nfile_path = r\"path\\to\\zwnbsp_test_data.txt\"\r\n\r\nresult = System.IO.File.ReadAllLines(file_path)\r\nprint(str(result[1][0]))\r\n```\r\n\r\nNative C# code does not seem to have this problem:\r\n```\r\nC#\r\nString[] lines = File.ReadAllLines(@\"path\\to\\zwnbsp_test_data.txt\");\r\n\r\nint firstChar = char.ConvertToUtf32(lines[1], 0);\r\nint secondChar = char.ConvertToUtf32(lines[1], 1);\r\nConsole.WriteLine(firstChar);\r\nConsole.WriteLine(secondChar);\r\n```\r\n\r\n\r\n[zwnbsp_test_data.txt](https://github.com/pythonnet/pythonnet/files/15194162/zwnbsp_test_data.txt)\r\n\r\nSome screenshots to help illustrate: \r\n\r\n\r\n\r\n- If there was a crash, please include the traceback here.\r\nNo crash\r\n","author":{"url":"https://github.com/AviParikh","@type":"Person","name":"AviParikh"},"datePublished":"2024-05-02T21:19:40.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":1},"url":"https://github.com/2369/pythonnet/issues/2369"}
| route-pattern | /:user_id/:repository/issues/:id(.:format) |
| route-controller | issues |
| route-action | show |
| fetch-nonce | v2:0ba3b64c-6bbd-7781-def3-5ea7df2df052 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | E7AA:287443:1214376:18153B0:69702DA5 |
| html-safe-nonce | 1214d8c2dc33858f0b7282ecd9fc9b470895b3c1e3dc3d4d167f9cf20ef6d60c |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJFN0FBOjI4NzQ0MzoxMjE0Mzc2OjE4MTUzQjA6Njk3MDJEQTUiLCJ2aXNpdG9yX2lkIjoiMjg3OTEyNzc2MzgxOTcwMzcxNyIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | c06d18ebb31ea70d70e5e906f0a8310b642b8c3cd48640f1a1bedf59f9f89f39 |
| hovercard-subject-tag | repository:14748123 |
| 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/pythonnet/pythonnet/issues/2369 |
| twitter:image | https://opengraph.githubassets.com/9c3eaa649f87ce8666e7f3954ab4d50595a3f98894df566864d36deadfbf2778/pythonnet/pythonnet |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/9c3eaa649f87ce8666e7f3954ab4d50595a3f98894df566864d36deadfbf2778/pythonnet/pythonnet |
| og:image:alt | Python for .NET is a package that gives Python programmers nearly seamless integration with the .NET Common Language Runtime (CLR) and provides a powerful application scripting tool for .NET develo... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| hostname | github.com |
| expected-hostname | github.com |
| None | 01fa379f5de85ef8e791d09724e69709ce9eb9595278316e0a921312dc88e0bc |
| turbo-cache-control | no-cache |
| go-import | github.com/pythonnet/pythonnet git https://github.com/pythonnet/pythonnet.git |
| octolytics-dimension-user_id | 6050430 |
| octolytics-dimension-user_login | pythonnet |
| octolytics-dimension-repository_id | 14748123 |
| octolytics-dimension-repository_nwo | pythonnet/pythonnet |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 14748123 |
| octolytics-dimension-repository_network_root_nwo | pythonnet/pythonnet |
| 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 | dda91974c069382b0dfa47b2da7e28bd061c8331 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width