Fix cp1250 decoding, log unsupported loads

The repositories resolved GetEncoding(1250) in their constructors, before
anything registered CodePagesEncodingProvider - reads fell back to Latin-1 and
Polish characters came out as mojibake.
This commit is contained in:
maj00r
2026-09-04 22:06:59 +02:00
parent 673cda57d7
commit b33d7697a0
13 changed files with 113 additions and 92 deletions

View File

@@ -169,11 +169,17 @@ public static class TrainsetDisplay
if (p != null)
massKg += p.Mass;
if (loadWeightKg != null &&
car.LoadCount > 0 &&
!string.IsNullOrEmpty(car.LoadType) &&
LoadAccepted(p, car.LoadType))
loadKg += (double)car.LoadCount * loadWeightKg(car.LoadType);
if (loadWeightKg != null && car.LoadCount > 0 && !string.IsNullOrEmpty(car.LoadType))
{
if (LoadAccepted(p, car.LoadType))
loadKg += (double)car.LoadCount * loadWeightKg(car.LoadType);
else
// The scenery loads something this vehicle's .fiz does not
// accept. It is left out of the gross mass, and saying so beats
// leaving the reading quietly short.
AppServices.Current.Log.Log(
$"{car.Name}: nieobslugiwany ladunek \"{car.LoadType}\"");
}
}
return (lengthM, massKg, loadKg);
}