Module:encodings/documentation

Hello, you have come here looking for the meaning of the word Module:encodings/documentation. In DICTIOUS you will not only get to know all the dictionary meanings for the word Module:encodings/documentation, but we will also tell you about its etymology, its characteristics and you will know how to say Module:encodings/documentation in singular and plural. Everything you need to know about the word Module:encodings/documentation you have here. The definition of the word Module:encodings/documentation will help you to be more precise and correct when speaking or writing your texts. Knowing the definition ofModule:encodings/documentation, as well as those of other words, enriches your vocabulary and provides you with more and better linguistic resources.

The module defines a set "encoders" which are able to encode the text into a given encoding. More encoders can be added to the module as necessary.

encode

Function encode(text, encoding)

Takes 'text' in UTF-8 encoding, encodes into 'encoding' and into %-encoding, returns the resulting string.

Explanation

  • UTF-8: the wiki software and all its pages and output use UTF-8.
  • %-encoding: 1) encoded text is bound to contain invalid UTF-8 text and Scribunto does not allow modules to return invalid UTF-8 text (replaces any invalid bytes in the output with � ), 2) primary use of this function is to encode text for use in URLs (external links), for certain sites that use older encodings.

Custom encoder methods

Number difference

  • Paste input and output hex-numbers to LibreOffice Calc and sort by input
  • Convert base-16 to base-10 (e.g. with onlinenumbertools.com, toolslick.com, or see below custom converter)
  • Calculate difference (using references)
  • Sort by difference, color the background of repeating differences, sort by input
Custom converter
<!DOCTYPE html>
<html>
<head>
<script>
function baseconvert() {
	var base0 = parseInt( document.querySelector("#base0").innerText );
	var base1 = parseInt( document.querySelector("#base1").innerText );
	var dText0 = document.querySelector("#text0");
	var dText1 = document.querySelector("#text1");
	var ns = dText0.value.split("\n"); // numbers
	dText1.innerHTML = "";
	for (var i=0; i < ns.length; i++) {
		if (i)
			dText1.append( "\n" );
		if ( ns.search(/^+$/gi) != -1 )
			dText1.append( parseInt(ns,base0).toString(base1) ); // XX > 10 > ZZ
	}
	dText0.style = "32px";  // variable .text height
	dText1.style = "32px";
	dText0.style = dText0.scrollHeight + "px";
	dText1.style = dText1.scrollHeight + "px";
}
document.addEventListener("DOMContentLoaded", function() {
	baseconvert();
	document.querySelector("#text0").addEventListener("input", baseconvert);
});
</script>
<style>
body {background: lightgray; display: grid; grid-template-columns: auto auto; gap: 8px;}
#desc {grid-column: 1 / -1;}
#desc, #base0, #base1 {justify-self: center; width: auto;}
#text0, #text1 {font-family: monospace, monospace; resize: none;}
</style>
</head>
<body>
	<div id="desc">Convert from left to right</div>
	<div id="base0" contenteditable>16</div>
	<div id="base1" contenteditable>10</div>
	<textarea id="text0">BADCAFE</textarea>
	<textarea id="text1" readonly></textarea>
</body>
</html>

{{R:IEC2}} (Catalan IEC dictionary) required input in ISO 8859-1 encoding:

  • {{#invoke:encodings|encode|abundància|ISO 8859-1}}
  • abund%E0ncia (< abundància)

See also