Error during getting CCompilerDriver

Please use the fix from @ilian's answer instead!!


The underlying problem

I think the underlying problem is with the RawJSON importer. JSON is required to be UTF8. But a character encoding like UTF8 only makes sense when reading from a file, not when reading from a string (using ImportString) that is already interpreted and doesn't have an encoding.

Here's a demonstration of what I believe is going wrong:

In[21]:= ImportString["\"jó\"", "RawJSON"]

During evaluation of In[21]:= Import::utf8incompletesequence: Input is not a valid UTF8 byte sequence. The final multibyte sequence is incomplete.

During evaluation of In[21]:= Import::jsonhintposandchar: An error occurred near character '"', at line 1:5

Out[21]= $Failed

The RawJSON importer seems to be interpreting the string as a byte-sequence instead of a character sequence.

We can change the string into a form that it will accept:

In[23]:= ExportString["\"jó\"", "Text", CharacterEncoding -> "UTF8"]    
Out[23]= "\"jÃ\.b3\""

Now it's happy:

In[24]:= ImportString[
 ExportString["\"jó\"", "Text", CharacterEncoding -> "UTF8"],
 "RawJSON"
 ]

Out[24]= "jó"

A possible workaround

I have not tested the following workaround as I am not using Windows at this moment, so I couldn't even reproduce the problem you see in a direct way.

However, I believe the following may work. Do this only with version 11.3.0 on Windows!!

Open the folder where the VS driver is using

SystemOpen@FileNameJoin[{$InstallationDirectory, "SystemFiles", "Components", "CCompilerDriver"}]

You should see the file VisualStudioCompiler.m. Make a backup and open it with a text editor. Find line 384, which should be:

$vsInfo := $vsInfo = If[$vswhereWorks, ImportString[$vswhereOutput, "RawJSON"], False]

Change it to

$vsInfo := $vsInfo = If[$vswhereWorks, ImportString[ExportString[$vswhereOutput, "Text", CharacterEncoding -> "UTF8"], "RawJSON"], False]

Restart Mathematica and try loading the C compiler driver again. Does it work now?


This has been fixed by a paclet update.

Windows 11.3 installations will be automatically updated over the next few days.

To get the new paclet immediately, try

PacletSiteUpdate /@ PacletSites[];
PacletUpdate["CCompilerDriver"]