path: root/src/corelib/codecs
diff options
authorThiago Macieira <>2013-10-19 23:04:47 -0400
committerThe Qt Project <>2014-01-09 22:34:54 +0100
commitcd750c86d62152855d7f1105a5a4dd86d8ff8797 (patch)
tree42a1d9780ab59390595c453486192ac3abdfc063 /src/corelib/codecs
parent8dd47e34b9b96ac27a99cdcf10b8aec506882fc2 (diff)
Use the new UTF-8 codec in QJsonDocument
The encoder is in qjsonwriter.cpp, which requires special handling for ASCII due to the use of escape sequences. The decoder is in qjsonparser.cpp, which only scan one character at a time. As a side-effect, the JSON parser now reports the UTF-8 error in the first character with error, instead of the last. This is probably what should have been expected. Change-Id: I52e5bc30d71466b6a36098b4150c61b2e385d8e9 Reviewed-by: Thiago Macieira <>
Diffstat (limited to 'src/corelib/codecs')
1 files changed, 5 insertions, 0 deletions
diff --git a/src/corelib/codecs/qutfcodec_p.h b/src/corelib/codecs/qutfcodec_p.h
index c94a7a12e4..c252edede7 100644
--- a/src/corelib/codecs/qutfcodec_p.h
+++ b/src/corelib/codecs/qutfcodec_p.h
@@ -108,6 +108,11 @@ struct QUtf8BaseTraits
{ *ptr++ = uc; }
+struct QUtf8BaseTraitsNoAscii : public QUtf8BaseTraits
+ static const bool skipAsciiHandling = true;
namespace QUtf8Functions
/// returns 0 on success; errors can only happen if \a u is a surrogate: