Re: Field retrieved from a Mongo document display wrong characters

2014-09-24 Thread Javier Miranda
Dear Jacqueline, thank you for your help.  In Mongo everything is UTF-8,
converting the string returned by the server to UTF-16 worked perfectly.
Let me add that I see great potential using LiveCode as a front end to
Mongo.

Saludos,

Javier Miranda V.
___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


Re: Field retrieved from a Mongo document display wrong characters

2014-09-24 Thread Andrew Kluthe
I agree. The document oriented format is a nice match for livecode arrays.
I have used mongodb (from mongolab.com) quite a bit (albiet over an http
interface of some kind). I had good experiences with it, save for
livecode's blocking url commands causing me some fuss.

Regards,

Andrew K

On Wed, Sep 24, 2014 at 4:04 AM, Javier Miranda jemiran...@gmail.com
wrote:

 Dear Jacqueline, thank you for your help.  In Mongo everything is UTF-8,
 converting the string returned by the server to UTF-16 worked perfectly.
 Let me add that I see great potential using LiveCode as a front end to
 Mongo.

 Saludos,

 Javier Miranda V.
 ___
 use-livecode mailing list
 use-livecode@lists.runrev.com
 Please visit this url to subscribe, unsubscribe and manage your
 subscription preferences:
 http://lists.runrev.com/mailman/listinfo/use-livecode




-- 
Regards,

Andrew Kluthe
and...@ctech.me
___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


Re: Field retrieved from a Mongo document display wrong characters

2014-09-21 Thread J. Landman Gay

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 | jac...@hyperactivesw.com
HyperActive Software   | http://www.hyperactivesw.com


___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


Field retrieved from a Mongo document display wrong characters

2014-09-19 Thread Javier Miranda
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?

The code in the button retrieving the document from mongo is:

on mouseUp

local theMongo, theDB, dbText, theCole, thePreg, theQuerry

put empty into field resul

put C:\mongodb\bin\mongo.exe localhost:27017/ into theMongo

put BatGar into theDB

put BatRegisinto theCole

put '  field F1  ' into toFind

put { quote  _id  quote  :   toFind  } into thePreg

put ; printjson(db.getLastError()) into dbErr

put  .find(  thePreg  );into theQuerry

put var c=db. theCole  theQuerry into dbText

put  while(c.hasNext()) after dbText

put  printjson(c.next()) after dbText

put dbErr after dbText

put theMongo  theDB   --eval   quote  dbText  quote  into dbText1

put shell ( quote dbText1  quote) into dbResultado

put the number of lines of dbResultado into nro

put line 3 to (nro - 1) of dbResultado into field resul

if field resul is  empty   then

Answer warning El Documento NO ha sido encontrado.  El sistema no
tiene registrada una Batería con el ID:field F1  with OK

else

Answer warning El Documento ha sido encontrado, ID:field F1
with OK

end if
end mouseUp


Saludos,
Javier
___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode