aboutsummaryrefslogtreecommitdiffstats
path: root/vanilla/node_modules/whatwg-url/lib/encoding.js
blob: cb66b8f10aee1c8a6125c4553213917ea95aba59 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
"use strict";
const utf8Encoder = new TextEncoder();
const utf8Decoder = new TextDecoder("utf-8", { ignoreBOM: true });

function utf8Encode(string) {
  return utf8Encoder.encode(string);
}

function utf8DecodeWithoutBOM(bytes) {
  return utf8Decoder.decode(bytes);
}

module.exports = {
  utf8Encode,
  utf8DecodeWithoutBOM
};