Special characters are converted when sending a request

1k views Asked by At

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)
1

There are 1 answers

0
user692942 On BEST ANSWER

Encoding in Classic ASP

When working with encoding in Classic ASP there is a check list you need to follow;

  1. Is the ASP page saved using required encoding? If you want to work with UTF-8, the page needs to first be saved using UTF-8 encoding.
  2. Does the ASP preproccessor know to process the ASP page using the specific encoding? You do this by specifying Response.CodePage and Response.Charset in your ASP page.
  3. 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)
    

Useful Links