Dynamic Web TWAIN: Failed to set request character encoding: [x-user-defined]


When downloading documents synchronously using the HTML5 edition, you might encounter the following error

Failed to set request character encoding: [x-user-defined]


Synchronous downloads require that the browser doesn't parse the returned data. Therefore, we override the MIME type using a user-defined character set forcing the browser to treat the returned data as plain text to let the bytes pass through unprocessed.

Some server-side libraries or scripts might have trouble understanding the charset x-user-defined. When this happens, you get the above error.


  1. Download asynchronously. Asynchronous downloads using the HTML5 edition treats the binary data as "blob", so there is no problem.
  2. Update your server-side library or related scripts to support the charset x-user-defined.


Sending and Receiving Binary Data

Is this page helpful?

Leave a Reply

Your email address will not be published.