mirror of
https://github.com/GoldenCheetah/GoldenCheetah.git
synced 2026-02-13 16:18:42 +00:00
Correct encoding in json parser
Fixes #408. modified: src/JsonRideFile.y
This commit is contained in:
@@ -74,15 +74,18 @@ static QString protect(const QString string)
|
||||
s.replace("\b", "\\b"); // backspace
|
||||
s.replace("\f", "\\f"); // formfeed
|
||||
s.replace("/", "\\/"); // solidus
|
||||
|
||||
return s;
|
||||
}
|
||||
|
||||
// Un-Escape special characters (JSON compliance)
|
||||
static QString unprotect(const QString string)
|
||||
{
|
||||
QString string2 = QString::fromLocal8Bit(string.toAscii().data());
|
||||
|
||||
// this is a lexer string so it will be enclosed
|
||||
// in quotes. Lets strip those first
|
||||
QString s = string.mid(1,string.length()-2);
|
||||
QString s = string2.mid(1,string2.length()-2);
|
||||
|
||||
// now un-escape the control characters
|
||||
s.replace("\\t", "\t"); // tab
|
||||
@@ -93,6 +96,7 @@ static QString unprotect(const QString string)
|
||||
s.replace("\\/", "/"); // solidus
|
||||
s.replace("\\\"", "\""); // quote
|
||||
s.replace("\\\\", "\\"); // backslash
|
||||
|
||||
return s;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user