NTS Informatica – Business

Internazionalizzazione e classic asp

Header e charset

If you’ve ever done work in non-English languages with Classic ASP (ASP3) and gotten black squares in side of the characters you expected, your checklist should be something like this.

Remember: The Absolute Minimum Every Software Developer Absolutely, Positively Must Know About Unicode and Character Sets (No Excuses!)

Classic ASP Internationalization “Don’t Lie” Checklist

  • Are your ASP pages saved as UTF-8? I recommend Notepad2 (or debug.exe 😉 ) as a good editor that knows what a Unicode Byte-Order-Mark looks like.
  • There’s two aspects to encoding with Classic ASP – there’s the encoding of the page (the static stuff) and the encoding of the dynamically created content.
    • Add this little-known bit-o-goodness to your pages:
      Response.CodePage = 65001
      Response.CharSet = “utf-8”
  • Make sure that the strings/content you are consuming is also the correct encoding. A very common problem is having Unicode content in an XML file but the prolog might say:
    <?xml version=”1.0″ encoding=”iso-1159-1″ ?>.
    This mistake will go unnoticed until José shows up.
    • Make sure your XML encoding matches you actual encoding:
      <?xml version=”1.0″ encoding=”UTF-8″ ?>.
  • You might also ensure your Http Headers don’t lie:
    Content-Type: text/html; charset=utf-8
  • You might also ensure your META tags don’t lie:
    <meta http-equiv=”Content-Type” content=”text/html; charset=UTF-8″ />

When all these things line up, things tend to just work. Again, this is old-school stuff, so you likely don’t care. Move along, nothing to see here.

Fonte https://www.hanselman.com/blog/internationalization-and-classic-asp