<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://linguifex.com/w/index.php?action=history&amp;feed=atom&amp;title=Module%3Astring%2Fencode_entities</id>
	<title>Module:string/encode entities - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://linguifex.com/w/index.php?action=history&amp;feed=atom&amp;title=Module%3Astring%2Fencode_entities"/>
	<link rel="alternate" type="text/html" href="https://linguifex.com/w/index.php?title=Module:string/encode_entities&amp;action=history"/>
	<updated>2026-04-06T00:22:44Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.43.6</generator>
	<entry>
		<id>https://linguifex.com/w/index.php?title=Module:string/encode_entities&amp;diff=374695&amp;oldid=prev</id>
		<title>Sware: Created page with &quot;local m_str_utils = require(&quot;Module:string utilities&quot;)  local codepoint = m_str_utils.codepoint local decode_entities = m_str_utils.decode_entities local find = string.find local format = string.format local gsub = string.gsub local match = string.match local pattern_escape = m_str_utils.pattern_escape  local function encode_entity(ch) 	return &quot;&amp;#x&quot; .. format(&quot;%X&quot;, codepoint(ch)) .. &quot;;&quot; end  return function(text, charset, raw) 	if not raw then 		text = decode_entities(te...&quot;</title>
		<link rel="alternate" type="text/html" href="https://linguifex.com/w/index.php?title=Module:string/encode_entities&amp;diff=374695&amp;oldid=prev"/>
		<updated>2024-08-06T10:39:07Z</updated>

		<summary type="html">&lt;p&gt;Created page with &amp;quot;local m_str_utils = require(&amp;quot;Module:string utilities&amp;quot;)  local codepoint = m_str_utils.codepoint local decode_entities = m_str_utils.decode_entities local find = string.find local format = string.format local gsub = string.gsub local match = string.match local pattern_escape = m_str_utils.pattern_escape  local function encode_entity(ch) 	return &amp;quot;&amp;amp;#x&amp;quot; .. format(&amp;quot;%X&amp;quot;, codepoint(ch)) .. &amp;quot;;&amp;quot; end  return function(text, charset, raw) 	if not raw then 		text = decode_entities(te...&amp;quot;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;local m_str_utils = require(&amp;quot;Module:string utilities&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
local codepoint = m_str_utils.codepoint&lt;br /&gt;
local decode_entities = m_str_utils.decode_entities&lt;br /&gt;
local find = string.find&lt;br /&gt;
local format = string.format&lt;br /&gt;
local gsub = string.gsub&lt;br /&gt;
local match = string.match&lt;br /&gt;
local pattern_escape = m_str_utils.pattern_escape&lt;br /&gt;
&lt;br /&gt;
local function encode_entity(ch)&lt;br /&gt;
	return &amp;quot;&amp;amp;#x&amp;quot; .. format(&amp;quot;%X&amp;quot;, codepoint(ch)) .. &amp;quot;;&amp;quot;&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
return function(text, charset, raw)&lt;br /&gt;
	if not raw then&lt;br /&gt;
		text = decode_entities(text)&lt;br /&gt;
	end&lt;br /&gt;
	if charset == &amp;quot;&amp;quot; then&lt;br /&gt;
		return text&lt;br /&gt;
	elseif not charset then&lt;br /&gt;
		charset = &amp;quot;\&amp;quot;&amp;amp;&amp;#039;&amp;lt;&amp;gt;\194\160&amp;quot;&lt;br /&gt;
	elseif not match(charset, &amp;quot;[\128-\244]&amp;quot;) then&lt;br /&gt;
		return (gsub(text, &amp;quot;[&amp;quot; .. pattern_escape(charset) .. &amp;quot;]&amp;quot;, encode_entity))&lt;br /&gt;
	end&lt;br /&gt;
	return (gsub(text, &amp;quot;[%z\1-\127\194-\244][\128-\191]*&amp;quot;, function(ch)&lt;br /&gt;
		return find(charset, ch, 1, true) and encode_entity(ch) or nil&lt;br /&gt;
	end))&lt;br /&gt;
end&lt;/div&gt;</summary>
		<author><name>Sware</name></author>
	</entry>
</feed>