Hi
I need to telnet into a host and send a text string. But it has to be a UTF-8 encoded string.
How can this be done ? I do not whant to write to a file first. Is VBscript the way to do it?
Like this:
Let>M=åäöÅÄÖ%CR%
UTF8encode>M,text // command that I like to have
TelnetConnect>IP,Port,hTN
-wait>.5
TelnetSend>hTN,%text%
Thanks!
Change text variable to UTF-8
Moderators: JRL, Dorian (MJT support)
-
- Pro Scripter
- Posts: 149
- Joined: Tue Mar 23, 2004 9:11 pm
- Marcus Tettmar
- Site Admin
- Posts: 7395
- Joined: Thu Sep 19, 2002 3:00 pm
- Location: Dorset, UK
- Contact:
Re: Change text variable to UTF-8
The telnet protocol only supports ANSI and Binary. Currently Macro Scheduler's Telnet implementation is ANSI only.
So you would need to use an alternative Telnet client or Telnet component via VBScript or maybe Python in order to do this.
So you would need to use an alternative Telnet client or Telnet component via VBScript or maybe Python in order to do this.
Marcus Tettmar
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar
Did you know we are now offering affordable monthly subscriptions for Macro Scheduler Standard?
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar
Did you know we are now offering affordable monthly subscriptions for Macro Scheduler Standard?
-
- Pro Scripter
- Posts: 149
- Joined: Tue Mar 23, 2004 9:11 pm
Re: Change text variable to UTF-8
Thanks, I have a feeling this can be fixed..
I think that it is possible to exchange the åäö characters in the variable with its utf-8 multi byte equivalent.
As explained in this good answer, (Is the MS telnet client binary 8bit?):
http://stackoverflow.com/questions/2562 ... g-in-utf-8
For example:
StringReplace>M,å,ä,M
or use the VBEval>Chr() method or similar.
What do You think.
will have to test this at work on monday.
I think that it is possible to exchange the åäö characters in the variable with its utf-8 multi byte equivalent.
As explained in this good answer, (Is the MS telnet client binary 8bit?):
http://stackoverflow.com/questions/2562 ... g-in-utf-8
For example:
StringReplace>M,å,ä,M
or use the VBEval>Chr() method or similar.
What do You think.
will have to test this at work on monday.
-
- Pro Scripter
- Posts: 149
- Joined: Tue Mar 23, 2004 9:11 pm
Re: Change text variable to UTF-8
Hi again!
This works very well.
Telnet itself does not understand the encoding. It only sends the 8bit characters. But the recieving system gets confused if it is not UTF-8 encoded characters.
So the solution was to replace the ANSI 'å' character with its UTF-8 counterpart = 'ä'
like this:
StringReplace>ANSIText,å,ä,UTF8Text
This works very well.
Telnet itself does not understand the encoding. It only sends the 8bit characters. But the recieving system gets confused if it is not UTF-8 encoded characters.
So the solution was to replace the ANSI 'å' character with its UTF-8 counterpart = 'ä'
like this:
StringReplace>ANSIText,å,ä,UTF8Text