Character Encoding / Display Issue

First of all I’m a first time poster, so apologies in advance if this has been asked / answered previously in the forum. I’ve done quite a bit of searching around but can’t seem to find the answer for the particular issue I have.

OK, here’s my issue.

I’m doing a HTTP socket call to bring back some data from a remote address (which I don’t control), and if I do the call manually in a browser I get a .txt file back with data that looks like this:

["Šola",[["šola petja petra januša",0],["šolaja film",0],["šola antonija",0],["šola",0],["šola da se ti zrola",0],["šolaja",0]

In my Xojo app I’m displaying this data inside a TextArea, but the problem I have is that all the accented characters are getting automatically replaced with the \Uxxx value, and so displays like this:

Also, the character ñ is getting auto-replaced with ?

So my question is this: Is there an easy way to auto-convert back to the display version of the accented characters? So instead of showing \U161 the correct character of Š will be shown.

I’ve tried using DefineEncoding and ConvertEncoding but no matter what I try it still remains.

I know I could do a RegEx, but as this issue would be across all the accented characters it would need to be added to as new case scenarios come in from my app users (which isn’t ideal, and would be quite a task to setup initially).

I’m hoping that there’s something simple I’m missing which will fix the problem, but I can’t seem to find it!


Well, that is probably a way of encoding the unicode characters.
So you would write code to look for \u and a number and replace it with encodings.utf8.chr(number)

I’m pretty sure you only have us part of the data and this is actually a json file. Use either the JSONItem class or the Xojo.Data.ParseJSON function and it will convert those codes back into text for you.