Skip to content

Commit

Permalink
switch to C locale to parse SVG in svgtiny (#6657)
Browse files Browse the repository at this point in the history
#changelog #addons
  • Loading branch information
oxillo committed Jan 7, 2021
1 parent f6608bf commit ea4c2c3
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions addons/ofxSvg/src/ofxSvg.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#include "ofxSvg.h"
#include "ofConstants.h"
#include <locale>

using namespace std;

Expand Down Expand Up @@ -49,7 +50,11 @@ void ofxSVG::loadFromString(std::string stringdata, std::string urlstring){
const char* url = urlstring.c_str();

struct svgtiny_diagram * diagram = svgtiny_create();
// Switch to "C" locale as svgtiny expect it to parse floating points (issue 6644)
std::locale prev_locale = std::locale::global( std::locale::classic() );
svgtiny_code code = svgtiny_parse(diagram, data, size, url, 0, 0);
// Restore locale
std::locale::global( prev_locale );

if(code != svgtiny_OK){
string msg;
Expand Down

0 comments on commit ea4c2c3

Please sign in to comment.