mirror of
https://github.com/pocoproject/poco.git
synced 2025-10-23 08:31:43 +02:00
GH #176: Poco::JSON::Stringifier UTF encoding
This commit is contained in:
@@ -221,7 +221,7 @@ private:
|
||||
{
|
||||
for(unsigned int i = 0; i < indent; i++) out << ' ';
|
||||
|
||||
out << '"' << getKey(it) << '"';
|
||||
Stringifier::stringify(getKey(it), out);
|
||||
out << ((indent > 0) ? " : " : ":");
|
||||
|
||||
Stringifier::stringify(getValue(it), out, indent + step, step);
|
||||
|
@@ -602,6 +602,10 @@ private:
|
||||
static const int _stateTransitionTable[NR_STATES][NR_CLASSES];
|
||||
static const int xx = -1;
|
||||
|
||||
bool isHighSurrogate(unsigned uc);
|
||||
bool isLowSurrogate(unsigned uc);
|
||||
unsigned decodeSurrogatePair(unsigned hi, unsigned lo);
|
||||
|
||||
Handler::Ptr _pHandler;
|
||||
signed char _state;
|
||||
signed char _beforeCommentState;
|
||||
@@ -713,6 +717,24 @@ inline void Parser::growBuffer()
|
||||
}
|
||||
|
||||
|
||||
inline bool Parser::isHighSurrogate(unsigned uc)
|
||||
{
|
||||
return (uc & 0xFC00) == 0xD800;
|
||||
}
|
||||
|
||||
|
||||
inline bool Parser::isLowSurrogate(unsigned uc)
|
||||
{
|
||||
return (uc & 0xFC00) == 0xDC00;
|
||||
}
|
||||
|
||||
|
||||
inline unsigned Parser::decodeSurrogatePair(unsigned hi, unsigned lo)
|
||||
{
|
||||
return ((hi & 0x3FF) << 10) + (lo & 0x3FF) + 0x10000;
|
||||
}
|
||||
|
||||
|
||||
}} // namespace Poco::JSON
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user