[Data-modeling] Writing UTF-8 in MQL strings
Kurt Bollacker
kurt at spaceship.com
Sat Mar 28 05:52:57 UTC 2009
On Sat, Mar 28, 2009 at 12:13:46AM -0400, Christopher R. Maden wrote:
> The *bytes* must be UTF-8. Not that the characters must be encodings of
> the representations of those bytes, but that the bytes on the wire must
> be in UTF-8.
> There is a levels of encoding problem here. To communicate the string
> “Mòoré” you can either:
> • send those characters as a UTF-8 byte stream (\x4D \xC3 \xB2 \x6F \x72
> \xC3 \xA9 on the wire)
> If you use JSON encoding, the \u notation must be of the Unicode code
> points. That is independent of the wire serialization of the MQL
> statements.
OK. I get it. With this explanation, I see that the spec exists but
is buried deeply in the bowels of chapter 4 of the MQL ref guide (see
footnote 10). What I was doing was a JSON encoding of a UTF-8
representation of characters, when I needed to be doing a UTF-8
encoding of JSON representations of characters. So I had my semantics
of encoding backwards. This is really not clear in the documentation.
A couple simple examples in the docs would make it very clear.
In any case, thanks for the help. One small change to my code seems
to make everything correct now.
Kurt :-)
More information about the Data-modeling
mailing list