From 425e6b242dd0f42f7b0d9c917059b7634fb233be Mon Sep 17 00:00:00 2001 From: Leon Holtmeier Date: Fri, 12 Jul 2024 20:37:29 +0200 Subject: [PATCH] fix the encoding of values read from Shapefile Signed-off-by: Leon Holtmeier --- backend/src/BIE.DataPipeline/Import/ShapeImporter.cs | 5 +++-- backend/src/BIE.DataPipeline/Properties/launchsettings.json | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/backend/src/BIE.DataPipeline/Import/ShapeImporter.cs b/backend/src/BIE.DataPipeline/Import/ShapeImporter.cs index 1beb4ffd..83bedf95 100644 --- a/backend/src/BIE.DataPipeline/Import/ShapeImporter.cs +++ b/backend/src/BIE.DataPipeline/Import/ShapeImporter.cs @@ -137,7 +137,8 @@ public bool ReadLine(out string nextLine) { var value = mParser.GetValue(i); mStringBuilder.Append(", '"); - mStringBuilder.Append(value); + var bytes = Encoding.GetEncoding("ISO-8859-1").GetBytes(value?.ToString() ?? ""); + mStringBuilder.Append(Encoding.UTF8.GetString(bytes)); mStringBuilder.Append("'"); // nextLine += $", \'{(value != "" ? value : "null")}\'"; } @@ -198,7 +199,7 @@ private double CalculateAreaInSquareMeters(Geometry geometry) public string GetCreationHeader() { return mHeader.Fields.Aggregate("Location GEOMETRY", - (current, field) => current + $", {field.Name} VARCHAR(255)"); + (current, field) => current + $", {field.Name} NVARCHAR(255)"); } /// diff --git a/backend/src/BIE.DataPipeline/Properties/launchsettings.json b/backend/src/BIE.DataPipeline/Properties/launchsettings.json index 52a2c97f..967d5a65 100644 --- a/backend/src/BIE.DataPipeline/Properties/launchsettings.json +++ b/backend/src/BIE.DataPipeline/Properties/launchsettings.json @@ -2,7 +2,7 @@ "profiles": { "BIE.DataPipeline": { "commandName": "Project", - "commandLineArgs": "--behavior=replace not_used/hausumringe_mittelfranken.yaml", + "commandLineArgs": "--behavior=replace common/actual_use_Kreisfreie_Stadt_Nuernberg.yaml", "workingDirectory": "yaml", "environmentVariables": { "DB_SERVER": "localhost",