This commit is contained in:
Rangel Reale
2012-12-28 11:55:12 -02:00
parent 79838aa76d
commit 3a2116233b

View File

@@ -38,6 +38,7 @@
#include "Poco/JSON/JSONException.h" #include "Poco/JSON/JSONException.h"
#include "Poco/Ascii.h" #include "Poco/Ascii.h"
#include "Poco/Token.h" #include "Poco/Token.h"
#include "Poco/UnicodeConverter.h"
#undef min #undef min
#undef max #undef max
#include <limits> #include <limits>
@@ -140,28 +141,28 @@ public:
switch(c) switch(c)
{ {
case '"' : case '"' :
c = '"'; _value += '"';
break; break;
case '\\' : case '\\' :
c = '\\'; _value += '\\';
break; break;
case '/' : case '/' :
c = '/'; _value += '/';
break; break;
case 'b' : case 'b' :
c = '\b'; _value += '\b';
break; break;
case 'f' : case 'f' :
c = '\f'; _value += '\f';
break; break;
case 'n' : case 'n' :
c = '\n'; _value += '\n';
break; break;
case 'r' : case 'r' :
c = '\r'; _value += '\r';
break; break;
case 't' : case 't' :
c = '\t'; _value += '\t';
break; break;
case 'u' : // Unicode case 'u' : // Unicode
{ {
@@ -196,7 +197,11 @@ public:
{ {
throw JSONException("Invalid unicode"); throw JSONException("Invalid unicode");
} }
c = unicode; //unicode to utf8
std::string utf8;
UnicodeConverter::toUTF8((const UTF32Char*)&unicode,1,utf8);
_value += utf8;
break; break;
} }
default: default:
@@ -204,8 +209,9 @@ public:
throw JSONException(format("Invalid escape '%c' character used", (char) c)); throw JSONException(format("Invalid escape '%c' character used", (char) c));
} }
} }
}else{
_value += c;
} }
_value += c;
c = istr.get(); c = istr.get();
} }