TextDecoder Web API | TextDecoder constructor Last Updated : 04 Oct, 2019 Comments Improve Suggest changes Like Article Like Report In HTML there is a TextDecoder Interface of which we can create a TextDecoder object for the encoding specified in parameter. Syntax: decoder = new TextDecoder( utf-Label, option ); Parameters: This constructor accepts two parameters which are mentioned above and described below: utf-Label: Label of the encoder in string format. It is "utf-8" as default. option: TextDecoderOptions dictionary which has a property fatal (It is a Boolean flag which indicates if the TextDecoder.decode() method should throw DOMException. It's default value is false.) Example 1: This example creating a TextDecoder object with "iso-8859-2" as parameter. html <!DOCTYPE html> <html> <head> <title> TextDecoder Web API | TextDecoder constructor </title> </head> <body> <center> <h1 style="color:green;"> GeeksforGeeks </h1> <h2>TextDecoder constructor</h2> <button onclick="gettextDecoder ();"> Get textDecoder object </button> <p id='textDecoder'></p> <script type="text/javascript"> function gettextDecoder() { var textDecoder1 = new TextDecoder("iso-8859-2"); console.log(textDecoder1); } </script> </center> </body> </html> Output: Before Click the button: After Click the button: Example: Create a comment object with nothing as parameter. So the default parameter which is "utf-8" will be taken. html <!DOCTYPE html> <html> <head> <title> TextDecoder Web API | TextDecoder constructor </title> </head> <body> <center> <h1 style="color:green;"> GeeksforGeeks </h1> <h2>TextDecoder constructor</h2> <button onclick="gettextDecoder ();"> Get textDecoder object </button> <p id='textDecoder'></p> <script type="text/javascript"> function gettextDecoder() { var textDecoder1 = new TextDecoder(); console.log(textDecoder1); } </script> </center> </body> </html> Output: Before Click the button: After Click the button: Supported Browsers: The browsers supported by TextDecoder constructor are listed below: Google Chrome 38 Firefox 19 Opera 25 Safari 10.1 Comment More infoAdvertise with us Next Article TextDecoder Web API | TextDecoder constructor D DeepakDev Follow Improve Article Tags : JavaScript Web Technologies HTML Web-API Similar Reads Web API TextEncoder encodeInto() Method The encodeInto() method in TextEncoder API is used to take stream of points and emits the stream of UTF-8 bytes. All instances of TextEncoder only support UTF-8 encoding. The TextEncoder.encodeInto() takes a string to encode and an array to hold the encoded result and returns an object back. Syntax: 2 min read Web API | TextDecoder decode() Method The decode() method in TextDecoder API is used to takes a stream of bytes as input and emits a stream of code points. The TextEncoder decode() method takes an ArrayBuffer containing the encoded data and options object and returns the original string (i.e. decoded string). Syntax: decoder.decode(buff 2 min read Node.js TextEncoder The TextEncoder is an interface that takes a stream of code points as input and emits a stream of encoded UTF-8 codes. This is provided in NodeJS as an implementation of the WHATWG Encoding Standard 'TextEncoder' API. All instances of TextEncoder only support UTF-8 encoding. UTF-8: It is an encoding 2 min read Node.js stringDecoder.write() Method The stringDecoder.write() method is used to return a decoded string from the given Buffer, TypedArray or DataView. This method also ensures that any incomplete multibyte characters at the end of the buffer are omitted from the returned string. These characters are stored in an internal buffer for th 2 min read Node.js stringDecoder.end() Method The stringDecoder.end() method is used to return all the remaining input stored in the internal buffer as a string. This method ensures that any incomplete UTF-8 and UTF-16 characters are replaced with substitution characters that are appropriate for character encoding. When the optional buffer argu 2 min read What are the encodeURI() and decodeURI() in JavaScript ? URLs and URIs are designed to locate/identify resources available over the internet, anything that uniquely identifies a resource is its URI, such as id, name. A URL specifies a resource and its access protocol. All URLs are URIs, but not all URIs are URLs. URI can only have certain characters from 3 min read Node.js Stream writable.setDefaultEncoding() Method The writable.setDefaultEncoding() method is an inbuilt application programming interface of Stream module which is used to set the default encoding for a Writable stream. Syntax: writable.setDefaultEncoding( encoding ) Parameters: This method accepts single parameter encoding which holds the encodin 2 min read JavaScript encodeURI(), decodeURI() and its components Functions The encodeURI() and decodeURI() functions in JavaScript are used to handle URI (Uniform Resource Identifier) encoding and decoding. They ensure that URIs are properly formatted for web usage, converting characters that may cause issues into a valid, encoded format.1. encodeURI() FunctionThe encodeUR 2 min read PHP | GmagickDraw gettextencoding() Function The GmagickDraw::gettextencoding() function is an inbuilt function in PHP which is used to get the code set used for text annotations. These code sets tell the computer how to interpret raw zeroes and ones into real characters. Usually, they produce the same text but use different code sets. Syntax: 2 min read PHP | ImagickDraw getTextEncoding() Function The ImagickDraw::getTextEncoding() function is an inbuilt function in PHP which is used to get the code set used for text annotations. These code sets tell the computer how to interpret raw zeroes and ones into real characters. Usually, they produce the same text but use different code sets. Syntax: 2 min read Like