Skip to content

Commit 52867ed

Browse files
committed
Revert "Merge pull request pocoproject#45 from RangelReale/jsonunicode"
This reverts commit dcf92dc, reversing changes made to 79838aa.
1 parent dcf92dc commit 52867ed

3 files changed

Lines changed: 10 additions & 47 deletions

File tree

JSON/src/Parser.cpp

Lines changed: 10 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,6 @@
3838
#include "Poco/JSON/JSONException.h"
3939
#include "Poco/Ascii.h"
4040
#include "Poco/Token.h"
41-
#include "Poco/UnicodeConverter.h"
4241
#undef min
4342
#undef max
4443
#include <limits>
@@ -141,28 +140,28 @@ class StringToken: public Token
141140
switch(c)
142141
{
143142
case '"' :
144-
_value += '"';
143+
c = '"';
145144
break;
146145
case '\\' :
147-
_value += '\\';
146+
c = '\\';
148147
break;
149148
case '/' :
150-
_value += '/';
149+
c = '/';
151150
break;
152151
case 'b' :
153-
_value += '\b';
152+
c = '\b';
154153
break;
155154
case 'f' :
156-
_value += '\f';
155+
c = '\f';
157156
break;
158157
case 'n' :
159-
_value += '\n';
158+
c = '\n';
160159
break;
161160
case 'r' :
162-
_value += '\r';
161+
c = '\r';
163162
break;
164163
case 't' :
165-
_value += '\t';
164+
c = '\t';
166165
break;
167166
case 'u' : // Unicode
168167
{
@@ -197,21 +196,16 @@ class StringToken: public Token
197196
{
198197
throw JSONException("Invalid unicode");
199198
}
200-
//unicode to utf8
201-
std::string utf8;
202-
UnicodeConverter::toUTF8((const UTF32Char*)&unicode,1,utf8);
203-
_value += utf8;
204-
199+
c = unicode;
205200
break;
206201
}
207202
default:
208203
{
209204
throw JSONException(format("Invalid escape '%c' character used", (char) c));
210205
}
211206
}
212-
}else{
213-
_value += c;
214207
}
208+
_value += c;
215209
c = istr.get();
216210
}
217211

JSON/testsuite/src/JSONTest.cpp

Lines changed: 0 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -859,35 +859,6 @@ void JSONTest::testTemplate()
859859
}
860860

861861

862-
void JSONTest::testUnicode()
863-
{
864-
const unsigned char supp[] = {0x61, 0xE1, 0xE9, 0x78, 0xED, 0xF3, 0xFA, 0x0};
865-
std::string text((const char*) supp);
866-
867-
std::string json = "{ \"test\" : \"a\u00E1\u00E9x\u00ED\u00F3\u00FA\" }";
868-
Parser parser;
869-
870-
Var result;
871-
try
872-
{
873-
DefaultHandler handler;
874-
parser.setHandler(&handler);
875-
parser.parse(json);
876-
result = handler.result();
877-
}
878-
catch(JSONException& jsone)
879-
{
880-
std::cout << jsone.message() << std::endl;
881-
assert(false);
882-
}
883-
assert(result.type() == typeid(Object::Ptr));
884-
885-
Object::Ptr object = result.extract<Object::Ptr>();
886-
Var test = object->get("test");
887-
assert(test.convert<std::string>() == text);
888-
}
889-
890-
891862
std::string JSONTest::getTestFilesPath(const std::string& type)
892863
{
893864
std::ostringstream ostr;
@@ -947,7 +918,6 @@ CppUnit::Test* JSONTest::suite()
947918
CppUnit_addTest(pSuite, JSONTest, testValidJanssonFiles);
948919
CppUnit_addTest(pSuite, JSONTest, testInvalidJanssonFiles);
949920
CppUnit_addTest(pSuite, JSONTest, testTemplate);
950-
CppUnit_addTest(pSuite, JSONTest, testUnicode);
951921

952922
return pSuite;
953923
}

JSON/testsuite/src/JSONTest.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,6 @@ class JSONTest: public CppUnit::TestCase
7676
void testInvalidJanssonFiles();
7777
void testTemplate();
7878
void testItunes();
79-
void testUnicode();
8079

8180
void setUp();
8281
void tearDown();

0 commit comments

Comments
 (0)