-
Notifications
You must be signed in to change notification settings - Fork 4.8k
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
Error if user in no python utf8 encoding ENV to run blazor AOT #53367
Comments
Japanese locale also has this issue. It requires @newbe36524 's workaround to publish without error.
|
I couldn't figure out the best area label to add to this issue. If you have write-permissions please help me learn by adding exactly one area label. |
Tagging subscribers to 'arch-wasm': @lewing Issue DetailsDescribe the bugUser have to set default encoding of python to utf8 when run blazor AOT. To ReproduceTry AOT as docs mentioned in a Chinese locals PC error as below: Compiling native assets with emcc. This may take a while ...
Traceback (most recent call last):
File "C:\Program Files\dotnet\packs\Microsoft.NET.Runtime.Emscripten.2.0.12.Sdk.win-x64\6.0.0-preview.4.21220.1\tools\emscripten\emcc.py", line 3315, in <module>
sys.exit(main(sys.argv))
File "C:\Program Files\dotnet\packs\Microsoft.NET.Runtime.Emscripten.2.0.12.Sdk.win-x64\6.0.0-preview.4.21220.1\tools\emscripten\emcc.py", line 3308, in main
ret = run(args)
File "C:\Program Files\dotnet\packs\Microsoft.NET.Runtime.Emscripten.2.0.12.Sdk.win-x64\6.0.0-preview.4.21220.1\tools\emscripten\emcc.py", line 2156, in run
post_link(options, wasm_target, wasm_target, target)
File "C:\Program Files\dotnet\packs\Microsoft.NET.Runtime.Emscripten.2.0.12.Sdk.win-x64\6.0.0-preview.4.21220.1\tools\emscripten\emcc.py", line 2185, in post_link
emscripten.run(in_wasm, wasm_target, final_js, memfile)
File "C:\Program Files\dotnet\packs\Microsoft.NET.Runtime.Emscripten.2.0.12.Sdk.win-x64\6.0.0-preview.4.21220.1\tools\emscripten\emscripten.py", line 876, in run
return temp_files.run_and_clean(lambda: emscript(
File "C:\Program Files\dotnet\packs\Microsoft.NET.Runtime.Emscripten.2.0.12.Sdk.win-x64\6.0.0-preview.4.21220.1\tools\emscripten\tools\tempfiles.py", line 104, in run_and_clean
return func()
File "C:\Program Files\dotnet\packs\Microsoft.NET.Runtime.Emscripten.2.0.12.Sdk.win-x64\6.0.0-preview.4.21220.1\tools\emscripten\emscripten.py", line 876, in <lambda>
return temp_files.run_and_clean(lambda: emscript(
File "C:\Program Files\dotnet\packs\Microsoft.NET.Runtime.Emscripten.2.0.12.Sdk.win-x64\6.0.0-preview.4.21220.1\tools\emscripten\emscripten.py", line 331, in emscript
glue, forwarded_data = compile_settings(temp_files)
File "C:\Program Files\dotnet\packs\Microsoft.NET.Runtime.Emscripten.2.0.12.Sdk.win-x64\6.0.0-preview.4.21220.1\tools\emscripten\emscripten.py", line 195, in compile_settings
out = shared.run_js_tool(path_from_root('src', 'compiler.js'),
File "C:\Program Files\dotnet\packs\Microsoft.NET.Runtime.Emscripten.2.0.12.Sdk.win-x64\6.0.0-preview.4.21220.1\tools\emscripten\tools\shared.py", line 118, in run_js_tool
return check_call(command, *args, **kw).stdout
File "C:\Program Files\dotnet\packs\Microsoft.NET.Runtime.Emscripten.2.0.12.Sdk.win-x64\6.0.0-preview.4.21220.1\tools\emscripten\tools\shared.py", line 104, in check_call
return run_process(cmd, *args, **kw)
File "C:\Program Files\dotnet\packs\Microsoft.NET.Runtime.Emscripten.2.0.12.Sdk.win-x64\6.0.0-preview.4.21220.1\tools\emscripten\tools\shared.py", line 94, in run_process
ret = subprocess.run(cmd, check=check, input=input, *args, **kw)
File "subprocess.py", line 507, in run
File "subprocess.py", line 1121, in communicate
UnicodeDecodeError: 'gbk' codec can't decode byte 0x94 in position 325809: illegal multibyte sequence
C:\Program Files\dotnet\packs\Microsoft.NET.Runtime.WebAssembly.Sdk\6.0.0-preview.4.21253.7\Sdk\WasmApp.targets(504,5): error MSB3073: The command "emcc "@D:\Repo\newbe\Newbe.BookmarkManager\src\Newbe.BookmarkManager\obj\Release\net6.0\wasm\emcc-link.rsp"" exited with code 1. [D:\Repo\newbe\Newbe.BookmarkManager\src\Newbe.BookmarkManager\Newbe.BookmarkManager.csproj] Set env PYTHONUTF8=1. Everything works. I think the root cause is the all emscripten scripts has no encoding header. Further technical detailsnet6 pre4
|
@newbe36524 Could you tell me how to |
Adding this to your project file should do it: <ItemGroup>
<EmscriptenEnvVars Include="PYTHONUTF8=1" />
</ItemGroup> |
I make this done in 'Enviroment Variabes' dialog in my Windows PC by add a new System variable |
Python defaults to the system charset, and thus expects the files it's reading to match that. But that might not always be true. Eg. system charset=gbk, failing to read utf-8 files. See dotnet/runtime#53367 for the motivating issue
Solution , click here #53367 (comment)
Describe the bug
User have to set default encoding of python to utf8 when run blazor AOT.
To Reproduce
Try AOT as docs mentioned in a Chinese locals PC
https://devblogs.microsoft.com/aspnet/asp-net-core-updates-in-net-6-preview-4/#blazor-webassembly-ahead-of-time-aot-compilation
error as below:
Set env PYTHONUTF8=1.
Everything works.
I think the root cause is the all emscripten scripts has no encoding header.
Further technical details
net6 pre4
The text was updated successfully, but these errors were encountered: