Field retrieved from a Mongo document display wrong characters

J. Landman Gay jacque at hyperactivesw.com
Sun Sep 21 15:31:16 EDT 2014


On 9/19/2014, 4:42 PM, Javier Miranda wrote:
> I have a local Mongo Server and a LiveCode Stack to work as front end to
> it.   When I enter "Se cambiarán los bornes" (please note the accent), in a
> LiveCode field, the text is properly shown, inserting it as a document to a
> Mongo collection also works fine, the field is saved OK in the document. I
> can see it using the Shell. The problem is that, when I retrieve the
> document back to LiveCode, the field receiving the field shows: "Se
> cambiarían los bornes". Trying to find the reason I found that the
> encoding of field "resul" , the field receiving the accented string is
> Native. Can you help finding the way to make this strings show the right
> characters?

I don't know anything about Mongo, but if it is sending back UTF8, then 
you need to convert it to UTF16:

function convertFromUTF8 pString -- convert a server UTF8 string to LC
   return unidecode(uniencode(pString,"UTF8"))
end convertFromUTF8

-- 
Jacqueline Landman Gay         |     jacque at hyperactivesw.com
HyperActive Software           |     http://www.hyperactivesw.com





More information about the use-livecode mailing list