From cd750c86d62152855d7f1105a5a4dd86d8ff8797 Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Sat, 19 Oct 2013 23:04:47 -0400 Subject: 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 --- src/corelib/codecs/qutfcodec_p.h | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'src/corelib/codecs') 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: -- cgit v1.2.3