Module talk:DecodeEncode

Bug report: bad decoding of U+03B5 ε (epsilon) 
About  U+03B5 &#x20; &#x03B5; GREEK SMALL LETTER EPSILON ( &amp;epsi; &amp;epsilon; )


 * Issue: after resolving HTML entity  by , the plain character is not found by  . No issue with alternative HTML entity  . &amp;epsi; good, &amp;epsilon; bad.


 * Report limitations: Original report and bug reproduction is at enwiki Module talk:DecodeEncode, from where en:module:DecodeEncode and en:module:String are used live. At phabricator pseudocode may be used and some "results" may be hardcoded. In-text the escape   is used, not in-function. Lua patterns not used ("no  ").


 * To reproduce:
 * 1. Create research string:
 * (shows live and unedited as: X&epsi;1X&epsilon;2X)
 * 2. Render the string by  (as inner function)
 * 3. then on rendered result use  to replace plain character   &rarr;  : (as outer function)
 * ), pattern=ε, repl=E ) [is pseudo-code, see note. 21:10, 7 February 2023 (UTC)]
 * 4. Result3 (s&r pattern use ε from ):
 * 5. Result4 (s&r pattern use ε from ):
 * 5. Result4 (s&r pattern use ε from ):


 * Expected:  (only one character   exists)


 * Note 21:10, 7 February 2023 (UTC): This step 3 is in pseudo-code. To reproduce, use Lua modules module:String and Module:DecodeEncode:
 * &rarr;
 * -DePiep (talk) 21:10, 7 February 2023 (UTC)
 * -DePiep (talk) 21:10, 7 February 2023 (UTC)

Workaround A, ad hoc
Workaround A, ad hoc: add innermost function to first replace in the research string  &rarr;  :
 * A1:  &rarr;

Workaround B, in module (THIN SPACE example)
Workaround B: early in en:module:DecodeEncode, replace  &rarr;

About THIN SPACE: it looks like character  U+2009 &#x20; THIN SPACE ( &amp;thinsp; &amp;ThinSpace; ) has a samilar issue. &amp;ThinSpace; good, &amp;thinsp; bad.

Currently in code:

In en:module:DecodeEncode/sandbox, I have coded a similar handling of EPSILON:
 * module:DecodeEncode, module:DecodeEncode/sandbox


 * /sandbox tests:
 * B.
 * B1. ResultB1 (s&r pattern use ε from ):
 * B2. ResultB2 (s&r pattern use ε from ):

I propose to edit the module along this way.

Workaround C (mw, Lua)
Changes in mw, Lua: I have not idea.


 * I propose to consider module editing along . -DePiep (talk) 12:26, 4 February 2023 (UTC)

testcases EPSILON

 * Original failure, now solved=not showing any more : 
 * (hardcoded explanation here): in cell marked ❌, the result showed as "XE1X&epsilon;2X". That is: wikitext input "&epsilon;" was not recognised & replaced. -DePiep (talk) 07:49, 19 February 2023 (UTC)


 * See for code change;
 * Similar fix as has (though original cause bug may be different for THIN SPACE).


 * Phabricator did not gain traction. Would be mw-level, not this module.
 * -DePiep (talk) 06:22, 16 February 2023 (UTC)

Template-protected edit request on 16 February 2023

 * Please copy all code from module:DecodeEncode/sandbox into module:DecodeEncode
 * Issue: bad decoding of HTML entity  ❌
 * re
 * Change: fix by replacing with entity  ✅ before applying  . See  for code diff & backgrounds; minor comment change
 * Discussion: (1) reported at, no responses (mw-level); (2) bug report here not challenged
 * Testcases: See.
 * DePiep (talk) 06:49, 16 February 2023 (UTC)
 * ✅ * Pppery * it has begun... 03:11, 19 February 2023 (UTC)

NBSP behaviour
Leaving this note here.

About NBSP,. With input I am experiencing problems reminding of  (, now resolved).

When nested like: (replace|s=(decode|s=AB YZ)|replace=AB_YZ) returns breaking code (breaking when used in/with HTML/css code like span, sup, class).

No time to build the reproduction/test, so have to leave it for now. Not reported on phab. DePiep (talk) 07:27, 20 February 2023 (UTC)

Template-protected edit request on 21 March 2023
Please replace all code Module:DecodeEncode with module:DecodeEncode/sandbox. 

Change: apply require('strict'), and declade function local explicit. DePiep (talk) 14:34, 21 March 2023 (UTC)


 * pause: needs some extra eyes first. Will invite. -DePiep (talk) 14:36, 21 March 2023 (UTC)
 * Invitation is out. -DePiep (talk) 14:49, 21 March 2023 (UTC)
 * Upd: Gonnym has made large improvements, so the sandboxdiff is large. I do not see strict-related changes. DePiep (talk) 21:31, 21 March 2023 (UTC)
 * The changes are good and no globals remain. The two mw.ustring could be string. Johnuniq (talk) 06:40, 22 March 2023 (UTC)
 * thx. As said, please someone with trust perform ER because me editing/commenting in between does not help. DePiep (talk) 08:18, 22 March 2023 (UTC)


 * Set no after two positive critiques. Also, I met no error while developing with this sandbox. -DePiep (talk) 09:00, 22 March 2023 (UTC)
 * ✅ &mdash; Martin (MSGJ · talk) 18:35, 22 March 2023 (UTC)