Skip to content

Commit

Permalink
Merge pull request #58 from matrix-org/hs/update-charset-packages
Browse files Browse the repository at this point in the history
Update character set based dependendencies
  • Loading branch information
Half-Shot authored May 18, 2021
2 parents f222abe + 0196d73 commit 1e89007
Show file tree
Hide file tree
Showing 4 changed files with 431 additions and 173 deletions.
4 changes: 2 additions & 2 deletions lib/irc.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ const tls = require('tls');
const util = require('util');
const isValidUTF8 = require('utf-8-validate');
const { EventEmitter } = require('events');
const { Iconv } = require('iconv-lite');
const detectCharset = require('detect-character-encoding');

const colors = require('./colors');
const parseMessage = require('./parse_message');
Expand Down Expand Up @@ -1277,11 +1279,9 @@ Client.prototype.ctcp = function(to, type, text) {

Client.prototype.convertEncoding = function(str) {
var self = this, out = str;
const Iconv = require('iconv').Iconv;

if (self.opt.encoding) {
try {
const detectCharset = require('detect-character-encoding');
const charset = detectCharset(str);
if (!charset) {
throw Error("No charset detected");
Expand Down
Loading

0 comments on commit 1e89007

Please sign in to comment.