Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
import * as windows1251 from 'windows-1251';
var text:string = "some text", byteString:string, decodedText:string;
var version:string = windows1251.version;
var labels:string[] = windows1251.labels;
byteString = windows1251.encode(text);
byteString = windows1251.encode(text, { mode: 'html' });
byteString = windows1251.encode(text, { mode: 'fatal' });
decodedText = windows1251.decode(byteString);
decodedText = windows1251.decode(byteString, { mode: 'fatal' });
decodedText = windows1251.decode(byteString, { mode: 'replacement' });
readMockPage: name => {
const string = fs
.readFileSync(`./tests/mocks/${name}.html`)
.toString("binary");
const html = windows1251.decode(string, { mode: "html" });
return html;
}
};
import * as windows1251 from 'windows-1251';
var text:string = "some text", byteString:string, decodedText:string;
var version:string = windows1251.version;
var labels:string[] = windows1251.labels;
byteString = windows1251.encode(text);
byteString = windows1251.encode(text, { mode: 'html' });
byteString = windows1251.encode(text, { mode: 'fatal' });
decodedText = windows1251.decode(byteString);
decodedText = windows1251.decode(byteString, { mode: 'fatal' });
decodedText = windows1251.decode(byteString, { mode: 'replacement' });
res.on('data', function(x) {
data = data + windows1251.decode(x, {mode: 'html'});
});
res.on('end', function() {
decodeWindows1251: string =>
windows1251.decode(string.toString("binary"), { mode: "html" }),