Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Passing Special Characters into telnet Unix

I use the following command to send SMS messages through SMS Adapters:

telnet localhost 0000 <<-EOF 
helo x
MAIL FROM: Test
RCPT TO: 447999999999
DATA

Test £1234
.
logout
quit
EOF

However when ever I get the Message through it will be in the format:

Test ?£1234

Appending the ? to the front of the £ symbol, I have tried investigating a few methods including MIME however not quite sure how they can be implemented.

Any ideas on how I can stop and allow the successful passthroughs of £

like image 214
Charabon Avatar asked Sep 13 '25 07:09

Charabon


1 Answers

Have you tried encoding the message first? You can do this using base64 in UTF-8 charset:- e.g. Convert: msg="£1234" To: msg="wqMxMjM0"

NOTE:Try testing encoding/decoding using the online converter - https://www.base64encode.org/

Once you have encoded your text you can send the message via telnet by adding the MIME details after the DATA command in telnet by specifying MIME types, example script below:-

telnet localhost 0000 <<-EOF 
helo x
MAIL FROM: Test
RCPT TO: 447999999999
DATA
Subject: Test
Mime-Version: 1.0
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: base64

${msg}
.
logout
quit
EOF

Hope that helps.

like image 129
Bexxy Avatar answered Sep 15 '25 20:09

Bexxy