Skip to content

Instantly share code, notes, and snippets.

@theY4Kman
Created February 13, 2017 15:50
Show Gist options
  • Save theY4Kman/ccf96271f98ddb18e7309bb6d7f92e83 to your computer and use it in GitHub Desktop.
Save theY4Kman/ccf96271f98ddb18e7309bb6d7f92e83 to your computer and use it in GitHub Desktop.
Authorize.net uses xml.dom.minidom to parse their responses. minidom doesn't handle unicode. We must pass it an encoded (as in bytes, not codepoints) string to it. Luckily, authorize.net has a hook to run code after execution.
from authorizenet import apicontrollersbase
def afterexecute(self):
self._httpResponse = self._httpResponse.encode('utf8')
apicontrollersbase.APIOperationBase.afterexecute = afterexecute
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment