How to check whether a specific character encoding is supported in Node.js

1 Answer

0 votes
console.log(Buffer.isEncoding("UTF-8"))

console.log(Buffer.isEncoding("hex"))

console.log(Buffer.isEncoding("base64"))

console.log(Buffer.isEncoding("US-ASCII"))

console.log(Buffer.isEncoding("UTF-32"))

console.log(Buffer.isEncoding("EBCDIC-US"))



 
 
 
/*
run:
 
true
true
true
false
false
false
 
*/

 



answered Aug 11, 2022 by avibootz

Related questions

1 answer 128 views
1 answer 119 views
1 answer 131 views
1 answer 189 views
1 answer 134 views
1 answer 126 views
...