Error when building a database: System does not support 'Windows-1252' encoding

Started by Fabo, December 25, 2021, 02:28:40 PM

Previous topic - Next topic

Fabo

Merry christmas all,

I've just installed Plan-G v4 on a new PC as I am planning a VFR flight (having used version 2 and 3 some years back when I was more active simmer), but I am having following error when trying to build a database.

15:14:00.7 StartBuild_Executed: System.Xml.XmlException: System does not support 'Windows-1252' encoding. Line 1, position 31.
---> System.ArgumentException: 'Windows-1252' is not a supported encoding name. For information on defining a custom encoding, see the documentation for the Encoding.RegisterProvider method. (Parameter 'name')
   at System.Text.EncodingTable.InternalGetCodePageFromName(String name)
   at System.Text.EncodingTable.GetCodePageFromName(String name)
   at System.Text.Encoding.GetEncoding(String name)
   at System.Xml.XmlTextReaderImpl.CheckEncoding(String newEncodingName)
   --- End of inner exception stack trace ---
   at System.Xml.XmlTextReaderImpl.Throw(Exception e)
   at System.Xml.XmlTextReaderImpl.Throw(String res, String[] args, Exception innerException)
   at System.Xml.XmlTextReaderImpl.Throw(String res, String arg, Exception innerException)
   at System.Xml.XmlTextReaderImpl.CheckEncoding(String newEncodingName)
   at System.Xml.XmlTextReaderImpl.ParseXmlDeclaration(Boolean isTextDecl)
   at System.Xml.XmlTextReaderImpl.Read()
   at Plan_G.Model.BGLSCAN.Scan() in C:\Users\Tim\source\repos\Plan-G\Model\BGLScan.cs:line 208
   at Plan_G.ViewModel.BuildDatabaseViewModel.StartBuild_Executed() in C:\Users\Tim\source\repos\Plan-G\ViewModel\BuildDatabaseViewModel.cs:line 143
15:14:48.1 Build-DB cleanup lambda

tim arnot

That's a new error to me. I'm guessing that's something introduced with Windows 11. I'll look into it.

Tim. @TimArnot

Fabo

I'm using Windows 10.

Let me know if you need any more diagnostics details.

tim arnot

Hmm. Okay. What are your language settings?

"Windows-1252" is the old one-byte character set from way back when. Plan-G should be using the fully multilingual UTF-8 pretty much everywhere. I'm certainly surprised it's asking for 1252.

Tim. @TimArnot

Fabo

This is indeed quite unusual but I don't know the codebase so...

Culture:                                                                                                                       
1033             en-US            English (United States)                                                                                                               

WinSystemLocale:
1033             en-US            English (United States)   

Fabo

Additionally:

[System.Text.Encoding]::Default


IsSingleByte      : True
BodyName          : iso-8859-1
EncodingName      : Western European (Windows)
HeaderName        : Windows-1252
WebName           : Windows-1252
WindowsCodePage   : 1252
IsBrowserDisplay  : True
IsBrowserSave     : True
IsMailNewsDisplay : True
IsMailNewsSave    : True
EncoderFallback   : System.Text.InternalEncoderBestFitFallback
DecoderFallback   : System.Text.InternalDecoderBestFitFallback
IsReadOnly        : True
CodePage          : 125


FWIW: I'm on a Windows 10 Pro version 1909 (seems my windows updates got... halted at some point?) which is originally installed over a Windows 7 installation.

The "Beta: Use Unicode UTF-8 for worldwide language support" checkbox is unchecked.

tim arnot

I looked a bit closer into where the error was coming from. It's actually from the XML reader, loading the list of addon sceneries. I can't tell from the log snippet whether you're building data for P3Dv5 or P3Dv4 (or earlier), but it's trying to read

"C:\ProgramData\Lockheed Martin\Prepar3D v5\scenery_add-ons.xml" (or v4, or...)

The first line of which is normally

<?xml version="1.0" encoding="UTF-8"?>

I suspect the file on your PC says some different encoding. Could you confirm that's the case? And if so, does changing this line to UTF-8 fix it?
Thanks.

Tim. @TimArnot

Fabo

Indeed the first line of the file does say Windows-1252, and upon changing to UTF-8 now the P3D (v4) DB is built successfully.

I guess this might be because of the default encoding, which would be probably due to the fact this laptop is a legacy Win 7 install updated through to current version of W10.