Session.URLParameter nil encoding

Related to the discussion here: https://forum.xojo.com/t/jsonitem-encoding-issue-in-2021-releases it seems as if Session.URLParameter() gives a string with a nil encoding. Shouldn’t it default to UTF8?

Edit to add: or maybe URLs are actually ASCII as per What character set should I assume the encoded characters in a URL to be in? - Stack Overflow

In either case, the answer “nil” seems to be the wrong encoding…

1 Like

<https://xojo.com/issue/65621>

WebSession has some inconsistent Encodings:

  • WebSession.URLParameter() has nil Encoding
  • WebSession.URL has UTF8 encoding (should this actually be ASCII?)
  • WebSession.HashTag has ASCII encoding
1 Like

Further testing reveals that the encoding is nil when the parameter exists, but not if the parameter is missing.

This encoding mess… xojo should, could well define and convert (if nil) default to UTF-8 even on the EncodeHex function it returns nil encoding, so put it on a jsonfile wil fail… better returned a UTF8 encoded hex string than… etc.

For web it would be nice if there was a content type charset given it could use that othwise default (if text-based) to utf8…

Agree - and since ASCII is always a valid subset of UTF8, I think defaulting to UTF8 would cause no harm.

1 Like