URL Encoding with ISO8859-15 is converted to Unknown format - rest

I have Rest API which sends SMS.
Content of the SMS is in French “Afin d'établir le tiers-payant pour votre traitement d'immunothérapie allergénique”
As SMS provider except the msg in IS08859-15 ,So I converted the msg into
Afin%20d%27%E9tablir%20le%20tiers-payant%20pour%20votre%20traitement%20d%27immunoth%E9rapie%20allerg%E9nique%2C
Here the final call which sends msg
https://xxxx.xxxx.com/xxxxxx/xx/SendMTRequest.jsp?UserName=xxxxxx&Password=xxxxxxx$&Content= %20d%27%E9tablir%20le%20tiers-payant%20pour%20votre%20traitement%20d%27immunoth%E9rapie%20allerg%E9nique%2C%&DA=Mobileno&Flags=0&SenderAppId=3410
with header
Content-Type ISO8859-15
What is received on the Server side is
20Afin%20d%27%ef%bf%bdtablir%20le%20tiers-payant%20pour%20votre%20traitement%20d%27immunoth%ef%bf%bdrapie%20allerg%ef%bf%bdnique%2c%
Can someone tell me why %E9 which is ISO88591-15 format for é is changed to %ef%bf%bd ?
and also a way to solve this.
Thank you

Related

javax.mail.Part and writeTo, unable to obtain the same "eml" file as the original one

My application parses many messages via javamail 1.5.6, it listens for incoming messages then store some info about them.
Almost all messages contain a digital signature, so my application needs to retrieve the full eml too, that is the raw file representing an email, in this way application users can always prove the validity of these messages.
So, once I have a javax.mail.Message, then I have to produces its eml, so I do:
ByteArrayOutputStream baos = new ByteArrayOutputStream();
m.writeTo(baos);
this.originalMessage = baos.toString(StandardCharsets.UTF_8.name());
this approach generally works, but I had some multipart messages having part like the following:
This is a multi-part message in MIME format.
--------------55D0DAEBFD4BF19F87D16E72 Content-Type: text/plain; charset=iso-8859-15; format=flowed Content-Transfer-Encoding: 8bit
In allegato si notifica ai sensi e per gli effetti dell'art. 11 R.D.
1611/1993, al messaggio PEC, oltre alla Relata di Notifica e
contestuale attestazione di conformità,
--------------55D0DAEBFD4BF19F87D16E72
word "conformità" is not properly transformed in the resulting string, it becomes "conformit�", opening such eml for example with MS Outlook results in an invalid digital signature, so message appears corrupted, different from the original
Have you same idea? Thank you very much
The raw message is not a UTF-8 encoded string, nor is an "eml" file a UTF-8 encoded file. They are both byte streams, and your digital signature should work on byte streams.
In your particular example, the content of the message part is encoded using the iso-8859-15 charset, not UTF-8.

Gammu and PostgreSQL send 8bit sms

I'm working with Gammu and PostgreSQL to send sms from my computer.
I have success sending a normal text sms.
But i have some problem now when trying to send 8bit (Binary) message to my devices. Here's my simple query to inject message to gammu 'outbox' table.
INSERT INTO outbox (
"DestinationNumber",
"Text",
"TextDecoded",
"Coding",
"UDH",
"CreatorID") VALUES (
'202555xxxx',
'02616A03776C66JF010000198C000403E800013003F200013003F30002323003F400023230',
'',
'8bit',
'06050407d50000',
'ConfigurationSMS');
as you can see 02616A03776C66JF010000198C000403E800013003F200013003F30002323003F400023230 is my SMS text encoded using hex values. The value is correct while in outbox table.
But when the message has been sent and i'm look on my inbox table, the Text value change to this 02616A03776C66BF0100000D8C000203E800013103F2000131FD00 00007400650073007400
Does anyone know why Gammu send different text? and how to prevent the changes occur? Thanks.
As mentioned before, there is invalid char in the HEX encoded string.
But I think Gammu should complain on such error, so I'll work on fixing that upstream, see https://github.com/gammu/gammu/issues/185 for progress.

Coldfusion - error when making SOAP request to Neolane

I am trying to make webservice SOAP requests to Neolane using Coldfusion and CFHTTP.
I have copied the SOAP request directly from Neolane's documentation, so I think that is okay.
The error message returned is :
SOAP-ENV:ClientLe message XML SOAP est incorrect (service '', méthode 'POST').Le nom de méthode 'ExecuteQuery' du paquet SOAP ne correspond pas à celui du paramètre 'action' de l'en-tête 'Content-Type' ('')
which translates to :
SOAP-ENV: clientle SOAP XML message is incorrect (service'' method 'POST'). The method name 'ExecuteQuery' SOAP package does not match the parameter 'action' in the header 'Content-type '('')
Is the action parameter in the Content-type header set by Coldfusion in the CFHTTP?
Is there something that should be added with cfhttpparam?
Any guidance would be appreciated.
Thanks,
Gary
Update: Found solution. Needed to add SOAPAction using cfhttpparam and use an alternative authentication method that was different from the example in the documentation.
Found solution. Needed to add SOAPAction using cfhttpparam and use an alternative authentication method that was different from the example in the documentation.

nodejs, redis and mailparser wont parse an email

I am using mailparser by andris(https://github.com/andris9/mailparser). I am sending an email via redis to an nodejs app. The mailparser for somereason is unable to parse it. What could be causing the issue?
The code to get the email from redis. client is an instance of node_redis Client. MailParser is andris' mailparser. The email in redis is sent via another server, to whose channel i have subscribed. The email sent, when saved in a text file and parsed using andris' test.js, gives the expected output.
client.subscribe('email1');
client.on('message', function(channel, message){
var Parser = new MailParser();
Parser.on('headers', function(headers){
console.log(headers.addressesTo[0].address);
});
Parser.feed(message);
Parser.end();
});
I found the reason for this. The input I saw receiving had \r\n converted to \n
Instead of
Parser.feed(message);
I believe you want
Parser.write(message);
I couldn't find the feed method in the documentation. I am using the write function and it's working. The message is the original unaltered email message, including headers, body, and attachments.

How to retrieve a IMAP body with the right charset?

I'm trying to make an "IMAP fetch" command to retrieve the message body. I need to pass/use the correct charset, otherwise the response will come with special characters.
How can I make the IMAP request/command to consider the charset I received in the BODYSTRUCTURE result??
The IMAP server will send non-ASCII message body data as an 8-bit "literal", which is essentially an array of bytes. You can't make the FETCH command use a specific charset, as far as I know.
It's up to the IMAP library or your application to decode the byte array into a string representation using the appropriate charset you received in the BODYSTRUCTURE response.