Solved.
I used the shim: https://github.com/inexorabletash/text-encoding and commented a condition part in the TextEncoder constructor to allow other charset.
Here is an example:
if (this._encoding === null /*|| (this._encoding.name !== 'utf-8' &&
this._encoding.name !== 'utf-16le' &&
this._encoding.name !== 'utf-16be')*/)
throw new TypeError('Unknown encoding: ' + opt_encoding);