<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>http://70.231.62.181/index.php?action=history&amp;feed=atom&amp;title=Module%3ADecodeEncode%2Fdoc</id>
	<title>Module:DecodeEncode/doc - Revision history</title>
	<link rel="self" type="application/atom+xml" href="http://70.231.62.181/index.php?action=history&amp;feed=atom&amp;title=Module%3ADecodeEncode%2Fdoc"/>
	<link rel="alternate" type="text/html" href="http://70.231.62.181/index.php?title=Module:DecodeEncode/doc&amp;action=history"/>
	<updated>2026-04-20T02:04:41Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.45.1</generator>
	<entry>
		<id>http://70.231.62.181/index.php?title=Module:DecodeEncode/doc&amp;diff=83815&amp;oldid=prev</id>
		<title>imported&gt;Grufo: +Cat</title>
		<link rel="alternate" type="text/html" href="http://70.231.62.181/index.php?title=Module:DecodeEncode/doc&amp;diff=83815&amp;oldid=prev"/>
		<updated>2025-04-22T08:11:39Z</updated>

		<summary type="html">&lt;p&gt;+Cat&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;{{Module rating |general}} &lt;br /&gt;
&amp;lt;!-- Please place categories where indicated at the bottom of this page and interwikis at Wikidata (see [[Wikipedia:Wikidata]]) --&amp;gt;&lt;br /&gt;
{{High-use}}&lt;br /&gt;
&lt;br /&gt;
Implements Lua functions [[:mw:Extension:Scribunto/Lua_reference_manual#mw.text.decode|mw.text.decode]], [[:mw:Extension:Scribunto/Lua_reference_manual#mw.text.encode|mw.text.encode]] in a module.&lt;br /&gt;
:&amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt;{{#invoke:decodeEncode|decode|s=Source&amp;amp;amp;nbsp;text&amp;amp;amp;copy;}}&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt; &amp;amp;rarr; &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt;Source&amp;amp;nbsp;text&amp;amp;copy;&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
See [[List of XML and HTML character entity references]].&lt;br /&gt;
&lt;br /&gt;
== Decode ({{mono|1=&amp;amp;amp;copy;}} &amp;amp;rarr; ©) &amp;lt;span class=&amp;quot;anchor&amp;quot; id=&amp;quot;Decode&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;==&lt;br /&gt;
{{hatnote|See {{slink||Known issues}} for possible THIN SPACE, epsilon issues}}&lt;br /&gt;
:Decodes [[List of XML and HTML character entity references|Named Entities]] &amp;#039;&amp;#039;from&amp;#039;&amp;#039; entity name &amp;#039;&amp;#039;into&amp;#039;&amp;#039; a regular (unicode) character:&lt;br /&gt;
:&amp;lt;code&amp;gt;&amp;amp;amp;copy;&amp;lt;/code&amp;gt; &amp;amp;rarr; &amp;lt;code&amp;gt;&amp;amp;copy;&amp;lt;/code&amp;gt;&lt;br /&gt;
:&amp;lt;code&amp;gt;&amp;amp;amp;gt;&amp;lt;/code&amp;gt; &amp;amp;rarr; &amp;lt;code&amp;gt;&amp;gt;&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
All well-defined named entities are decoded ([https://html.spec.whatwg.org/multipage/named-characters.html#named-character-references HTML Named character references], formally: as defined in the [https://www.php.net/get_html_translation_table PHP table]).&lt;br /&gt;
&lt;br /&gt;
:A regular, rendered sentence:&lt;br /&gt;
::&amp;quot;At 100 °F, &amp;amp; with a &amp;quot;burning&amp;quot; sun above, we , we ⁄walked⁄.&amp;quot;&lt;br /&gt;
&lt;br /&gt;
:In code:&lt;br /&gt;
::&amp;quot;&amp;lt;code&amp;gt;At 100&amp;amp;amp;nbsp;&amp;amp;amp;deg;F, &amp;amp;amp; with a &amp;amp;amp;quot;burning&amp;amp;amp;quot; sun above, we &amp;amp;amp;frasl;walked&amp;amp;amp;frasl;.&amp;lt;/code&amp;gt;&amp;quot; -- wikitext&lt;br /&gt;
&lt;br /&gt;
:Processing:&lt;br /&gt;
:&amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt;{{#invoke:decodeEncode|decode|s=At 100&amp;amp;nbsp;&amp;amp;deg;F, &amp;amp;amp; with a &amp;amp;quot;burning&amp;amp;quot; sun above, we &amp;amp;frasl;walked&amp;amp;frasl;.}}&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt; &amp;amp;rarr;&lt;br /&gt;
::&amp;lt;code&amp;gt;{{#invoke:decodeEncode|decode|s=At 100&amp;amp;nbsp;&amp;amp;deg;F, &amp;amp;amp; with a &amp;amp;quot;burning&amp;amp;quot; sun above, we &amp;amp;frasl;walked&amp;amp;frasl;.}}&amp;lt;/code&amp;gt; -- In code: straight characters, no named entities.&lt;br /&gt;
&lt;br /&gt;
:Renders, again:&lt;br /&gt;
::&amp;quot;At 100 °F, &amp;amp; with a &amp;quot;burning&amp;quot; sun above, we ⁄walked⁄.&amp;quot;&lt;br /&gt;
&lt;br /&gt;
===Decode a reduced set only===&lt;br /&gt;
By setting {{para|subset_only|true}}, only these five entity names are decoded: &amp;#039;&amp;amp;amp;lt;&amp;#039;, &amp;#039;&amp;amp;amp;gt;&amp;#039;, &amp;#039;&amp;amp;amp;amp;&amp;#039;, &amp;#039;&amp;amp;amp;quot;&amp;#039;, &amp;#039;&amp;amp;amp;nbsp;&amp;#039; (that is, into &amp;#039;&amp;amp;lt;&amp;#039;, &amp;#039;&amp;amp;gt;&amp;#039;, &amp;#039;&amp;amp;amp;&amp;#039;, &amp;#039;&amp;amp;quot;&amp;#039;, &amp;#039;&amp;amp;nbsp;&amp;#039;).&lt;br /&gt;
&lt;br /&gt;
:&amp;#039;&amp;#039;&amp;#039;Note&amp;#039;&amp;#039;&amp;#039;: There is a difference with the relevant Lua parameter. (This only concerns your task if you also work directly with the Lua mw.text.decode function). Lua documentation defines parameter {{para|decodeNamedEntities}}, having this effect: when &amp;#039;&amp;#039;omitted or false&amp;#039;&amp;#039;, only the reduced set of entities is recognized and decoded. This use of &amp;#039;false&amp;#039; is &amp;#039;&amp;#039;inverted&amp;#039;&amp;#039; in using {{para|subset_only}}: {{para|decodeNamedEntities|false}} =  {{para|subset_only|true}}.&lt;br /&gt;
&lt;br /&gt;
:Also, this module ignores the &amp;quot;omitted&amp;quot; logic: {{para|subset_only}} should be set explicitly to &amp;#039;true&amp;#039; to be effective.&lt;br /&gt;
&lt;br /&gt;
== Encode (© &amp;amp;rarr; {{mono|1=&amp;amp;amp;copy;}}) &amp;lt;span class=&amp;quot;anchor&amp;quot; id=&amp;quot;Encode&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;==&lt;br /&gt;
:Function &amp;lt;code&amp;gt;encode&amp;lt;/code&amp;gt; encodes some entity-named characters into that name (for example: &amp;lt;code&amp;gt;&amp;amp;&amp;lt;/code&amp;gt; &amp;amp;rarr; &amp;lt;code&amp;gt;&amp;amp;amp;amp;&amp;lt;/code&amp;gt;).&lt;br /&gt;
&lt;br /&gt;
Regular sentence:&lt;br /&gt;
:&amp;quot;At &amp;gt;100 °F, &amp;amp; with a &amp;quot;burning&amp;quot; sun above, we walked. ©&amp;quot;&lt;br /&gt;
&lt;br /&gt;
In code:&lt;br /&gt;
:&amp;quot;&amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt;At &amp;gt;100 °F, &amp;amp; with a &amp;quot;burning&amp;quot; sun above, we walked. ©&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt;&amp;quot;&lt;br /&gt;
&lt;br /&gt;
Encode:&lt;br /&gt;
:&amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt;{{#invoke:decodeEncode|encode|s=At &amp;gt;100 °F, &amp;amp; with a &amp;quot;burning&amp;quot; sun above, we walked. ©|charset=&amp;amp;&amp;lt;&amp;gt;{{!}}°&amp;quot;&amp;#039;&amp;amp;©}}&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:&amp;amp;rarr;&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt;At &amp;amp;amp;gt;100 &amp;amp;amp;#176;F, &amp;amp;amp;amp; with a &amp;amp;amp;quot;burning&amp;amp;amp;quot; sun above, we walked. &amp;amp;amp;#169;&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt;&amp;lt;!-- used Special:ExpandTemplate --&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:Renders as:&lt;br /&gt;
&lt;br /&gt;
:&amp;quot;At &amp;amp;gt;100 &amp;amp;#176;F, &amp;amp;amp; with a &amp;amp;quot;burning&amp;amp;quot; sun above, we walked. &amp;amp;#169;&amp;quot;&lt;br /&gt;
===character set to encode===&lt;br /&gt;
&lt;br /&gt;
Per Lua documentation, only a small set of characters is processed. The characterset can be set (expanded) by using {{para|charset}}.&lt;br /&gt;
&lt;br /&gt;
:Example: {{para|charset|&amp;lt;nowiki&amp;gt;&amp;lt;&amp;gt;&amp;quot; \&amp;#039;&amp;amp;&amp;lt;/nowiki&amp;gt;}} (the default), {{para|charset|&amp;lt;nowiki&amp;gt;&amp;lt;&amp;gt;°&amp;quot;&amp;#039;&amp;amp;©{{!}}&amp;lt;/nowiki&amp;gt;}}; characters not in the default will be replaced by their decimal entity: &amp;lt;code&amp;gt;©&amp;lt;/code&amp;gt; &amp;amp;rarr; &amp;lt;code&amp;gt;&amp;amp;amp;#169;&amp;lt;/code&amp;gt; &amp;lt;small&amp;gt;(hexadecimal number, not decimal nor named &amp;amp;amp;copy;)&amp;lt;/small&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Known issues &amp;lt;span class=&amp;quot;anchor&amp;quot; id=&amp;quot;Template&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;==&lt;br /&gt;
* 13 Sep 2021: NOTE: The encode function with user-supplied charset is now used productively  in {{tl|R/superscript}} and {{tl|R/ref}}. Before implementing breaking changes here, these templates need to be adjusted accordingly!&lt;br /&gt;
&lt;br /&gt;
* 26 Sep 2021: {{unichar|2009|THIN SPACE|html=}} &lt;br /&gt;
:Note: Possible bug: Decoding &amp;lt;code&amp;gt;&amp;amp;amp;ThinSpace;&amp;lt;/code&amp;gt; works, but &amp;lt;code&amp;gt;&amp;amp;amp;thinsp;&amp;lt;/code&amp;gt; doesn&amp;#039;t.&lt;br /&gt;
:Resolved in code.&lt;br /&gt;
&lt;br /&gt;
*  4 Feb 2023: {{unichar|03B5|GREEK SMALL LETTER EPSILON|html=}}&lt;br /&gt;
{{tracked|T328840}}&lt;br /&gt;
:See {{slink|Module_talk:DecodeEncode|Bug_report:_bad_decoding_of_U+03B5_ε_(epsilon)}}&lt;br /&gt;
:Resolved in code.&lt;br /&gt;
&lt;br /&gt;
==See also==&lt;br /&gt;
&lt;br /&gt;
* [[:mw:Extension:Scribunto/Lua_reference_manual#mw.text.decode|mw.text.decode]]&lt;br /&gt;
* [[:mw:Extension:Scribunto/Lua_reference_manual#mw.text.encode|mw.text.encode]]&lt;br /&gt;
* [[:Module:Urldecode]]&lt;br /&gt;
&lt;br /&gt;
{{Navbox wikitext-handling templates}}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;includeonly&amp;gt;{{sandbox other||&lt;br /&gt;
&amp;lt;!-- Categories below this line, please; interwikis at Wikidata --&amp;gt;&lt;br /&gt;
[[Category:Wikitext processing templates]]&lt;br /&gt;
[[Category:Modules that manipulate strings]]&lt;br /&gt;
[[Category:Template metamodules]]&lt;br /&gt;
}}&amp;lt;/includeonly&amp;gt;&amp;lt;noinclude&amp;gt;&lt;br /&gt;
[[Category:Module documentation pages]]&lt;br /&gt;
&amp;lt;/noinclude&amp;gt;&lt;/div&gt;</summary>
		<author><name>imported&gt;Grufo</name></author>
	</entry>
</feed>