Failed to build database (System does not support 'Windows-1252' encoding...)

Started by PilotWim, July 13, 2022, 12:32:28 PM

Previous topic - Next topic

PilotWim

Hello,

I installed v4.0.0.259 (next to v3) but when trying to build the database, I received the above error.

I searched the forum and this topic recommends to edit "C:\ProgramData\Lockheed Martin\Prepar3D v3\scenery_add-ons.xml" and replace the first line <?xml version="1.0" encoding="Windows-1252"?> with <?xml version="1.0" encoding="UTF-8"?> as a workaround. This indeed allowed me to build the database.

However, every time P3D launches, the scenery_add-ons.xml file is re-created when scenery changes have happened, and P3Dv3.4 insists on using "Windows-1252". I use Lorby-SI's excellent P3D Addon Organiser to manage my sceneries, but even if you manage the addons from within P3D (Options, Add-ons), P3D needs to restart and hence re-creates the xml with the "wrong" encoding.

I can't imagine having to modify the xml after each scenery modification, just to be able to build the database.

Regards,
-=Wim=-

PS 1: In the "Build Navigation Database" window the option "Build P3D v5 Database" is enabled but I don't have P3Dv5. Why does Plan-G think that v5 is installed?
PS 2: The "Build Database" error message gives a line and position where the error occurred and points you to the log file for more details. Would it be possible to also show the name of the file that caused the error? It doesn't appear in the log file either. Also, pointing to the log file is good, but showing the actual path of the logfile would be really helpful :-)

tim arnot

My first thought is why are you rebuilding your database so frequently? Are you changing configurations and rebuilding every time you run P3D? If so, that's completely unnecessary. Either build the database with all sceneries enabled, or if that's not possible (it used to be that multiple Orbx regions couldn't be active at the same time) you can add the inactive sceneries via the Additional Sceneries list. Either way you should only need to build the database once. Until you install a totally new airport anyway.

2. Sounds like you have something that indicates v5 is present, either a v5 config or a v5 registry entry, or you populated the v5 location in Build Options.

3.The exception handler doesn't know the name of the file being processed. But the name of the folder being worked on at least should be in the log. The log file is in the Plan-Gv4 Files folder (which may be wherever you've told it to be). This is documented in both the Quick Start Guide and the Read Me. However, I'll add it to the to-do list for the next build.

Tim. @TimArnot

PilotWim

With our little online flight group, we do a weekly flight. We start where we landed last week and after landing, we decide on the destination airport for the next week. Some members look for (and test) freeware sceneries for the next destination. More often than not they find a good one and share it with us. That's why I install new scenery almost weekly and need to rebuild the database.

2. All the locations in the Build Options are empty. In the registry I found P3D entries in HKCU and HKLM:
[HKEY_CURRENT_USER\SOFTWARE\Lockheed Martin\Prepar3D v3]
"AppPath"="C:\\FlightSimulator\\Lockheed Martin\\Prepar3D v3\\"
"SimConnect_Port_IPv6"="0"
"SimConnect_Port_IPv4"="0"
"Installed"=dword:00000001

[HKEY_CURRENT_USER\SOFTWARE\Lockheed Martin\Prepar3D v3 SDK]
"InstalledProgramMenuSubDir"=dword:00000001

[HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432Node\Lockheed Martin\Prepar3D v3]
"License"="Academic"
"SetupPath"="C:\\FlightSimulator\\Lockheed Martin\\Prepar3D v3\\"

[HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432Node\Lockheed Martin\Prepar3D v3 Content]
"SetupPath"="C:\\FlightSimulator\\Lockheed Martin\\Prepar3D v3\\"

[HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432Node\Lockheed Martin\Prepar3D v3 Scenery]
"SetupPath"="C:\\FlightSimulator\\Lockheed Martin\\Prepar3D v3\\"

[HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432Node\Lockheed Martin\Prepar3D v3 SDK]
"SetupPath"="C:\\FlightSimulator\\Lockheed Martin\\Prepar3D v3 SDK 3.3.5.17625\\"
What is Plan-G exactly checking in the registry or in config files?

3. I just tried to rebuild and this is from the log file:
22:37:23.2 Building database for P3D
22:37:23.2 FS directory is: C:\FlightSimulator\Lockheed Martin\Prepar3D v3\
22:37:23.2 P3v3D cfg path: C:\ProgramData\Lockheed Martin\Prepar3D v3\Scenery.cfg
22:37:23.2 Processing P3D XML addons
22:37:23.3 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
22:37:25.2 Build-DB cleanup lambda
22:37:25.4 NdbsInBounds 1
22:37:25.4 VorsInBounds 3
22:37:25.4 AirportsInBounds 4
22:37:25.6 AirspaceInBounds N:39,44 S:38,67 W:21,94 E:24,14  10
22:37:28.5 Cleanup
It only says "Processing P3D XML addons"
but maybe "Processing P3D XML addons: C:\ProgramData\Lockheed Martin\Prepar3D v3\scenery_add-ons.xml"
would be more informative?
Thanks for considering to add the log file location to the error message.

Regards,
-=Wim=-

tim arnot

There are two checks:
* The P3Dv5 button on the data ribbon is active if there is a P3Dv5 database in the /Data folder
* The Build P3Dv5 button on the Build dialog is active if either a path for P3dv5 has been specified in Build Options or one of the P3dv5 registry locations is set (either AppPath or SetupPath)

Build 261 should handle Codepage 1252. Plus the logging changes :)
(but there's also a database schema change, so you'll definitely need to rebuild databases)

Tim. @TimArnot

PilotWim

Thanks for the new version.
I can confirm that the Windows-1252 encoding problem is solved. The log file also shows the name of the xml file.

However, I found another problem in the log file: when a scenery path has a comma in the name as in "C:\FlightSimulator\Lockheed Martin\MyScenery\LICC - Catania, Sicily", that comma is replaced by "&comma;" and then it gets a DirectoryNotFoundException:
18:49:50.0 Scanning folder C:\FlightSimulator\Lockheed Martin\MyScenery\LICC - Catania&comma; Sicily
18:49:50.0 Directory error: System.IO.DirectoryNotFoundException: Could not find a part of the path 'C:\FlightSimulator\Lockheed Martin\MyScenery\LICC - Catania&comma; Sicily\Scenery'.
  at System.IO.Enumeration.FileSystemEnumerator`1.CreateDirectoryHandle(String path, Boolean ignoreNotFound)
  at System.IO.Enumeration.FileSystemEnumerator`1.Init()
  at System.IO.Enumeration.FileSystemEnumerator`1..ctor(String directory, Boolean isNormalized, EnumerationOptions options)
  at System.IO.Enumeration.FileSystemEnumerable`1..ctor(String directory, FindTransform transform, EnumerationOptions options, Boolean isNormalized)
  at System.IO.Enumeration.FileSystemEnumerableFactory.FileInfos(String directory, String expression, EnumerationOptions options, Boolean isNormalized)
  at System.IO.DirectoryInfo.InternalEnumerateInfos(String path, String searchPattern, SearchTarget searchTarget, EnumerationOptions options)
  at Plan_G.Model.BGLSCAN.Scan() in C:\Users\Tim\source\repos\Plan-G\Model\BGLScan.cs:line 235

Quote from: tim arnot on July 15, 2022, 12:44:11 PM* The Build P3Dv5 button on the Build dialog is active if either a path for P3dv5 has been specified in Build Options or one of the P3dv5 registry locations is set (either AppPath or SetupPath)
I'm afraid that's not the case.
I installed a new W10 Pro 21H2 Virtual Machine and downloaded Plan-G v4.0.1.262 into it. I started the program and clicked "Build Navigation Database" on the the Data tab. The dialog box shows enabled check boxes for "Build P3D Database" as wel as "Build P3D v5 Database"! Then I clicked "Settings..." and saw that every entry was empty, except for the "Plan-G Files Folder".

tim arnot

Thanks.
I'll look into the &comma thing, and I'll take another look at the v5 installed test.

Tim. @TimArnot