French and Other Language Characters – Classic ASP

Recently working with PayPal and Classic ASP I stumbled unto a problem where French characters were being encoded and displayed as unreadable text. It turns out that PayPal returns the result to you using UTF-8. In C# this would be an easy fix. Language characters can be tough in classic ASP.  I had searched for quite a while until I found the following code:

  function URLDecode(sConvert)  
     Dim JSEngine  
     Set JSEngine = CreateObject("MSScriptControl.ScriptControl")  
       JSEngine.Language = "JScript"  
       sConvert = Replace(sConvert, "+", " ")  
       URLDecode = JSEngine.CodeObject.decodeURIComponent(sConvert)  
 end fucntion  

This solved my issue, but it took forever to find the solution. I hope this can save someone else time.

Contact me if you have questions integrating ASP with PayPal.

Published by

ldnDeveloper

Andrew Pallant (@LdnDeveloper) has been a web, database and desktop developer for over 16 years. Andrew has worked on projects that ranged from factory automation to writing business applications. Most recently he has been heavily involved in various forms for ecommerce projects. Over the years Andrew has worn many hats: Project Manager, IT Manager, Lead Developer, Supervisor of Developers and many more - See more at: http://www.unlatched.com/#sthash.8DiTkpKy.dpuf