Skip to content

Commit

Permalink
TechDraw - Fix Annotation and Symbol international characters mangling
Browse files Browse the repository at this point in the history
  • Loading branch information
pavltom authored and WandererFan committed Oct 7, 2019
1 parent 91ae525 commit 7157a4a
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 7 deletions.
2 changes: 1 addition & 1 deletion src/Gui/propertyeditor/PropertyItem.cpp
Expand Up @@ -2315,7 +2315,7 @@ QVariant PropertyStringListItem::value(const App::Property* prop) const
QStringList list;
const std::vector<std::string>& value = ((App::PropertyStringList*)prop)->getValues();
for ( std::vector<std::string>::const_iterator jt = value.begin(); jt != value.end(); ++jt ) {
list << QString::fromUtf8(jt->c_str());
list << QString::fromUtf8(Base::Tools::escapedUnicodeToUtf8(*jt).c_str());
}

return QVariant(list);
Expand Down
6 changes: 4 additions & 2 deletions src/Mod/TechDraw/App/DrawViewSymbol.cpp
Expand Up @@ -39,6 +39,7 @@
#include <Base/Exception.h>
#include <Base/FileInfo.h>
#include <Base/Console.h>
#include <Base/Tools.h>

#include "QDomNodeModel.h"
#include "DrawUtil.h"
Expand Down Expand Up @@ -102,7 +103,7 @@ void DrawViewSymbol::onChanged(const App::Property* prop)
while (!queryResult.next().isNull())
{
QDomElement tspanElement = model.toDomNode(queryResult.current().toNodeModelIndex()).toElement();
editables.push_back(tspanElement.text().toStdString());
editables.push_back(Base::Tools::escapedUnicodeFromUtf8(tspanElement.text().toStdString().c_str()));
}
}
else {
Expand Down Expand Up @@ -162,7 +163,8 @@ App::DocumentObjectExecReturn *DrawViewSymbol::execute(void)
}

// Finally append text node with editable replacement as the only <tspan> descendant
tspanElement.appendChild(symbolDocument.createTextNode(QString::fromUtf8(editText[count].c_str())));
tspanElement.appendChild(symbolDocument.createTextNode(
QString::fromUtf8(Base::Tools::escapedUnicodeToUtf8(editText[count]).c_str())));
++count;
}

Expand Down
8 changes: 4 additions & 4 deletions src/Mod/TechDraw/Gui/QGIViewAnnotation.cpp
Expand Up @@ -48,6 +48,7 @@
#include <App/Material.h>
#include <Base/Console.h>
#include <Base/Parameter.h>
#include <Base/Tools.h>

#include <Mod/TechDraw/App/DrawViewAnnotation.h>
#include "Rez.h"
Expand Down Expand Up @@ -151,11 +152,10 @@ void QGIViewAnnotation::drawAnnotation()
ss << "color:" << c.asCSSString() << "; ";
ss << "}\n</style>\n</head>\n<body>\n<p>";
for(std::vector<std::string>::const_iterator it = annoText.begin(); it != annoText.end(); it++) {
if (it == annoText.begin()) {
ss << *it;
} else {
ss << "<br>" << *it ;
if (it != annoText.begin()) {
ss << "<br>";
}
ss << Base::Tools::escapedUnicodeToUtf8(*it);
}
ss << "<br></p>\n</body>\n</html> ";

Expand Down

0 comments on commit 7157a4a

Please sign in to comment.