Skip to content

Instantly share code, notes, and snippets.

@ericlaw1979
Created May 18, 2017 20:58
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ericlaw1979/533f898c503429dbc4f89494c01d2cc9 to your computer and use it in GitHub Desktop.
Save ericlaw1979/533f898c503429dbc4f89494c01d2cc9 to your computer and use it in GitHub Desktop.
public static void OnBeforeResponse(Session oSession) {
// If the response body starts with a Utf-8 signature, overwrite it with spaces
if (oSession.ResponseBody.Length > 3 &&
oSession.ResponseBody[0] == 0xEF &&
oSession.ResponseBody[1] == 0xBB &&
oSession.ResponseBody[2] == 0xBF)
{
oSession.ResponseBody[0] = 0x20;
oSession.ResponseBody[1] = 0x20;
oSession.ResponseBody[2] = 0x20;
oSession["ui-backcolor"] = "red";
oSession.ResponseHeaders["old-Content-Type"] = oSession.ResponseHeaders["Content-Type"];
oSession.ResponseHeaders["Content-Type"] = (oSession.ResponseHeaders["Content-Type"] + "; charset=utf-8");
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment