From 75e5cd9168eb0d70a6061c98be66283b5a94cf0f Mon Sep 17 00:00:00 2001 From: cyber-toad Date: Wed, 19 Feb 2025 10:09:47 +0100 Subject: [PATCH] [gpx] Use cdata for name field in gpx export Signed-off-by: cyber-toad --- data/test_data/gpx/export_test.gpx | 2 +- kml/serdes_gpx.cpp | 6 +++++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/data/test_data/gpx/export_test.gpx b/data/test_data/gpx/export_test.gpx index 03f31b35e4..87e3a53057 100644 --- a/data/test_data/gpx/export_test.gpx +++ b/data/test_data/gpx/export_test.gpx @@ -5,7 +5,7 @@ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.topografix.com/GPX/1/1 https://www.topografix.com/GPX/1/1/gpx.xsd http://www.topografix.com/GPX/gpx_style/0/2 https://www.topografix.com/GPX/gpx_style/0/2/gpx_style.xsd http://www.garmin.com/xmlschemas/GpxExtensions/v3 https://www.garmin.com/xmlschemas/GpxExtensionsv3.xsd"> - My route + <&"]]> & "]]> diff --git a/kml/serdes_gpx.cpp b/kml/serdes_gpx.cpp index 1a95c31030..fb7dd376f9 100644 --- a/kml/serdes_gpx.cpp +++ b/kml/serdes_gpx.cpp @@ -557,7 +557,11 @@ void SaveCategoryData(Writer & writer, CategoryData const & categoryData) { writer << "\n"; if (auto const name = GetDefaultLanguage(categoryData.m_name)) - writer << kIndent2 << "" << *name << "\n"; + { + writer << kIndent2 << ""; + SaveStringWithCDATA(writer, *name); + writer << "\n"; + } if (auto const description = GetDefaultLanguage(categoryData.m_description)) { writer << kIndent2 << "";