So I'm implement mandrill in asp classic. Everything was fine so far, the mail was sent but I got a problem. When I send a parameter with special character, the content in email got converted. For example, The value I sent to mandrill is Göran
but in email, it got convert to Göran
.
I have tried to change CodePage session but it didn't work. Using ajax jQuery and send the same value, the email look fine. Do I need to set up something in request
Response.CodePage = 65001
Session.CodePage = 65001
Set HttpReq = Server.CreateObject("MSXML2.ServerXMLHTTP")
HttpReq.open "POST", "https://mandrillapp.com/api/1.0/messages/send-template.json", False
HttpReq.setRequestHeader "Content-Type", "application/json"
HttpReq.send(mandrillData)
When working with encoding in Classic ASP there is a check list you need to follow;
Response.CodePage
and Response.Charset
in your ASP page.When sending encoded data to a 3rd party, do you tell them what to expect? For example, when sending JSON the Content-Type
header is important but so is the charset
argument to specify how the content is encoded.
Call HttpReq.setRequestHeader("Content-Type", "application/json; charset=utf-8")
Call HttpReq.Send(mandrillData)