<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://wiki.mozilla.org/index.php?action=history&amp;feed=atom&amp;title=ServerJS%2FEncodings%2FOldClass</id>
	<title>ServerJS/Encodings/OldClass - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://wiki.mozilla.org/index.php?action=history&amp;feed=atom&amp;title=ServerJS%2FEncodings%2FOldClass"/>
	<link rel="alternate" type="text/html" href="https://wiki.mozilla.org/index.php?title=ServerJS/Encodings/OldClass&amp;action=history"/>
	<updated>2026-08-14T13:45:07Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.39.10</generator>
	<entry>
		<id>https://wiki.mozilla.org/index.php?title=ServerJS/Encodings/OldClass&amp;diff=139400&amp;oldid=prev</id>
		<title>MrN: Created page with &#039;=== Class: Converter ===  There also should be a class enc.Converter for more advanced conversion.  Please note that the interface is &#039;&#039;one way&#039;&#039;. Despite the fact that it has tw...&#039;</title>
		<link rel="alternate" type="text/html" href="https://wiki.mozilla.org/index.php?title=ServerJS/Encodings/OldClass&amp;diff=139400&amp;oldid=prev"/>
		<updated>2009-04-09T23:49:01Z</updated>

		<summary type="html">&lt;p&gt;Created page with &amp;#039;=== Class: Converter ===  There also should be a class enc.Converter for more advanced conversion.  Please note that the interface is &amp;#039;&amp;#039;one way&amp;#039;&amp;#039;. Despite the fact that it has tw...&amp;#039;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;=== Class: Converter ===&lt;br /&gt;
&lt;br /&gt;
There also should be a class enc.Converter for more advanced conversion.&lt;br /&gt;
&lt;br /&gt;
Please note that the interface is &amp;#039;&amp;#039;one way&amp;#039;&amp;#039;. Despite the fact that it has two methods, it&amp;#039;s &amp;#039;&amp;#039;one way&amp;#039;&amp;#039;. It only supports &amp;#039;&amp;#039;encoding&amp;#039;&amp;#039;, &amp;#039;&amp;#039;&amp;#039;no&amp;#039;&amp;#039;&amp;#039; decoding! Multiple people have got that wrong when glancing over it, so it&amp;#039;s emphasised here.&lt;br /&gt;
&lt;br /&gt;
; [Constructor] Converter(from, to)&lt;br /&gt;
: Where from and to are the encoding names.&lt;br /&gt;
; [Method] write(byteStringOrArray)&lt;br /&gt;
: Convert input from a ByteString or ByteArray. The results are stored in an internal buffer, and also those parts of byteStringOrArray that could not be converted (for multi-byte encodings, in a separate buffer).&lt;br /&gt;
: Returns nothing.&lt;br /&gt;
; [Method] read([byteArray,] [maximumSize])&lt;br /&gt;
: Read maximumSize bytes or as many bytes as available out of the internal buffer. If byteArray is specified, the data is &amp;#039;&amp;#039;appended&amp;#039;&amp;#039; to that ByteArray.&lt;br /&gt;
: Returns a ByteString if byteArray is not specified, or byteArray itself otherwise.&lt;br /&gt;
; [Method] close()&lt;br /&gt;
: Close the stream. Throws an exception if there was a conversion error (specifically, a partial multibyte character).&lt;br /&gt;
: Returns nothing and takes no parameters.&lt;br /&gt;
&lt;br /&gt;
Example usage:&lt;br /&gt;
&lt;br /&gt;
  Converter = require(&amp;#039;encodings&amp;#039;).Converter&lt;br /&gt;
  converter = new Converter(&amp;#039;iso-8859-1&amp;#039;, &amp;#039;utf-32&amp;#039;)&lt;br /&gt;
  converter.write(input) // input is a ByteString&lt;br /&gt;
  output = converter.read() // output is a ByteString&lt;br /&gt;
  converter.close()&lt;/div&gt;</summary>
		<author><name>MrN</name></author>
	</entry>
</feed>