'How to change CharSet when using Indy TIdHTTPServer:ServeFile()?

My Javascript, HMTL etc files are being served using charset ISO-8859-1, but I need then to have charset=utf-8. I've tried using AResponseInfo->CharSet = "utf-8" but it seems to make no difference.

I've done this, which works, but I'd rather not repeat the test for every possible file extension.

  AResponseInfo->ContentDisposition = "inline";
  if (paths::getExtension(requestedFile, true) == ".JS")
    AResponseInfo->ContentType = "text/javascript; charset=utf-8";

  AResponseInfo->SmartServeFile(AContext, ARequestInfo,uString(requestedFile)); 

(side note: This may be because I'm using a version of Indy10 that's a few years old with RadStudio 2010. What's the easiest way to upgrade Indy?)



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source