[gpx] Use cdata for name field in gpx export

Signed-off-by: cyber-toad <the.cyber.toad@proton.me>
This commit is contained in:
cyber-toad 2025-02-19 10:09:47 +01:00 committed by Konstantin Pastbin
parent 9240602fa5
commit 75e5cd9168
2 changed files with 6 additions and 2 deletions

View file

@ -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">
<metadata>
<name>My route</name>
<name><![CDATA[My route ><&"]]></name>
<desc><![CDATA[You will see this in the document and can use reserved characters like < > & "]]></desc>
</metadata>
<wpt lat="48.209846" lon="16.376023">

View file

@ -557,7 +557,11 @@ void SaveCategoryData(Writer & writer, CategoryData const & categoryData)
{
writer << "<metadata>\n";
if (auto const name = GetDefaultLanguage(categoryData.m_name))
writer << kIndent2 << "<name>" << *name << "</name>\n";
{
writer << kIndent2 << "<name>";
SaveStringWithCDATA(writer, *name);
writer << "</name>\n";
}
if (auto const description = GetDefaultLanguage(categoryData.m_description))
{
writer << kIndent2 << "<desc>";