Repository navigation
Commit 7086d2d
committed
Fix encoding 866 crash: register CodePagesEncodingProvider + add System.Text.Encoding.CodePages
Problem:
Python.CreateEngine() crashes with:
'Failed to load language IronPython 2.7.12: No data is available for encoding 866'
This happens because SharedIO.InitializeInput() accesses Console.InputEncoding
which returns cp866 on Russian Windows. In Dynamo/Revit hosting environment
or on .NET Core, cp866 is not registered, causing ArgumentException.
Fix:
1. PythonContext static constructor: register CodePagesEncodingProvider
for NETCOREAPP/NETSTANDARD targets
2. IronPython.csproj: add System.Text.Encoding.CodePages package for
non-net45 targets (net45 has codepages built-in)
Note: The DLR submodule (Src/DLR) also needs a corresponding fix in
SharedIO.cs to wrap Console.InputEncoding/Output access in try-catch
with UTF-8 fallback. That fix is in a separate commit in the DLR repo.1 parent bd43cf1 commit 7086d2d
3 files changed
Lines changed: 11 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
103 | 103 | | |
104 | 104 | | |
105 | 105 | | |
106 | | - | |
| 106 | + | |
107 | 107 | | |
108 | 108 | | |
109 | 109 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
61 | 61 | | |
62 | 62 | | |
63 | 63 | | |
64 | | - | |
| 64 | + | |
65 | 65 | | |
66 | 66 | | |
67 | 67 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
44 | 44 | | |
45 | 45 | | |
46 | 46 | | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
47 | 56 | | |
48 | 57 | | |
49 | 58 | | |
| |||
0 commit comments