diff --git a/package.json b/package.json index 31f0994..e5e4c8d 100644 --- a/package.json +++ b/package.json @@ -8,7 +8,8 @@ "test": "mocha" }, "dependencies": { - "axios": "^0.24.0" + "axios": "^0.24.0", + "he": "^1.2.0" }, "devDependencies": { "chai": "^4.2.0", diff --git a/src/dolmetscher.js b/src/dolmetscher.js index a8bed72..176caa5 100644 --- a/src/dolmetscher.js +++ b/src/dolmetscher.js @@ -1,5 +1,6 @@ const axios = require("axios"); const fs = require("fs"); +const he = require("he"); const languages = require('./languages'); class BaseTranslator { @@ -106,7 +107,7 @@ class GoogleTranslator extends BaseTranslator { const body = html.slice(idx); const translated = body.substring(0, body.indexOf("<")); - return translated; + return he.decode(translated); } catch (err) { throw `translation error: ${err} `; }