DefineEncoding of Xojo.core.dictionary

I create a Xojo.core.dictionary from HTTP request headers. When I pass the dictionary to another function, I get a Xojo.core.invalidargumentexception, reason: root: String value does not have a specified encoding.

I have tried setting the encoding on each header value as I add it to the dictionary.

for i = 0 to vNames.Ubound d.Value(Uppercase(vNames(i))) = DefineEncoding(Request.GetRequestHeader(vNames(i), Encodings.UTF8)) next

I have tried defining the encoding when I generate JSON.

DefineEncoding(xojo.Data.GenerateJSON(d), Encodings.UTF8)

I have also tried…

Dim t As Auto ** also tried As Text t = xojo.Data.GenerateJSON(d) Dim j As new JSONItem(DefineEncoding(t, Encodings.UTF8))

What am I not understanding?

I wonder if Uppercase is retuning a String without an encoding.

Just figured it out. Seems to be the dictionary key that was having the issue.

[code] for i = 0 to vNames.Ubound
hKey = DefineEncoding(vNames(i), Encodings.UTF8)

  dHeader.Value(Uppercase(hKey)) = DefineEncoding(Request.GetRequestHeader(vNames(i)), Encodings.UTF8)

Yeah, you’re welcome.