[Gambas-user] Re: Using serial component for plc comunications

Daniel daniel.campos at ...338...
Wed Jun 2 15:36:55 CEST 2004


El mié, 02-06-2004 a las 13:50, Marcelo Duschkin escribió:
> El Mié 02 Jun 2004 03:54, Daniel escribió:
> |> Well, the problem is that we were trying to send an array of bytes, but
> |> using functions that were designed to work with UTF-8, in which, not
> |> always 1 character = 1 byte
> 
> That can explain some extraneous chars...
> Now, the question is:
> How can I "force" to not use UTF8 in the transmited string?


 You have to convert the string using 'Conv$' function, which allows
you to convert from UTF-8 to a lot of codifications, but you need to
be sure what codification uses your device. 

 Using characters from Chr(32) to Chr(127) there's no problem with
UTF-8, as they have the same codification, but with other characters
you've to select the right encoding. 

 However, if you add characters "by hand", I mean "Cadena=Cadena &
chr(6) & chr(8)"... , each character added is just a byte, you've not
to worry about UTF-8 or any other codification. 

 Finally, remember always to write and read in this way:

...
Write #Serial_or_Socket, MyString, Len(MyString)
...

and

...
Read #Serial_or_Socket, MyString, Lof(Serial_Or_Socket)
...


 

> 
> Thanks for your help.
> Este intercambio hubiera sido más fácil en español... ;)

Pues sí, pero así practicamos english :-))

Un saludo,

Daniel Campos


> 
> -- Para el cierre: ---
> El Pingüinoráculo solía citar:
> El tiempo es un buen maestro, pero acaba matando a sus pupilos.
> - - -
> Marcelo Duschkin - Buenos Aires - Argentina
> mardus at ...298...
> www.websdelsur.com.ar
> www.lahueya.com.ar
> 
> 
> 
> -------------------------------------------------------
> This SF.Net email is sponsored by the new InstallShield X.
> >From Windows to Linux, servers to mobile, InstallShield X is the one
> installation-authoring solution that does it all. Learn more and
> evaluate today! http://www.installshield.com/Dev2Dev/0504
> _______________________________________________
> Gambas-user mailing list
> Gambas-user at lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/gambas-user





More information about the User mailing list