[pmwiki-users] Strange characters, but only in some cases on Markup parse

Christopher Cox chriscox at endlessnow.com
Sun Nov 1 07:14:13 PST 2026


On 11/1/26 1:23 AM, Petko Yotov wrote:
> On 31/10/2026 23:59, Christopher Cox wrote:
>> https://youtu.be/euLOyGadyDs&list=PLZOfSznMOwYenRt25XSChMwxxim5bKVOx&index=104
>>
>> I get (notice the 18B19B at the end):
>>
>> [31-Oct-2026 17:52:54 America/Chicago] yt site: //youtu.be
>> [31-Oct-2026 17:52:54 America/Chicago] yt id and parms: 
>> euLOyGadyDs&list=PLZOfSznMOwYenRt25XSChMwxxim5bKVOx&index=10418B19B
>>
>> The difference is the m[4] aspect ratio in quotes is missing, But isn't that 
>> ok here? (zero or one time)  And I'm still not sure what the 18B19B means?
> 
> In your example, there seems to be no aspect ratio in quotes after the link.
> 
> When I enabled your custom markup, both your links, ending with "4:3", got 
> correctly found on the page.
> 
> These 18B and 19B may be "keep tokens", some markup or escaped text that was 
> passed through Keep() and, in the "B" case, expected to be restored just before 
> markup blocks are processed.
> 
> If so, it is actually $KeepToken + 18B + $KeepToken; each $KeepToken contains 2 
> control characters that browsers may not display.
> 
> Note that now people may [=escape=] URLs with special characters to avoid url- 
> encoding them, e.g. spaces or parentheses like this:
> 
> https://en.wikipedia.org/wiki/[=Wiki (disambiguation)=]
> 
> So the Keep tokens may be part of the URL, to be restored and encoded later.
> 
> You can call RestoreMarkup() to see what was escaped.

This too was caused by my custom markup that didn't include line endings after 
Keeps.  Once I fixed that, the problem is now gone.

> 
> Petko
> 
> 
> On 31/10/2026 23:59, Christopher Cox wrote:
>> Consider this cookbook recipe snippet (I'm looking for youtube video links):
>>
>> Markup('youtu_be_watch','<urllink',
>> "/\\b(?>(\\L))(\/\/youtu\.be)\/([^\\s$UrlExcludeChars]+)(\"[0-9]+:[0-9]+\")?/",
>>   "YoutubeWatchLink");
>>
>> function YoutubeWatchLink($m) {
>>   extract($GLOBALS["MarkupToHTML"]); # get $pagename
>>
>>   $aspectRatio = '';
>>   error_log('yt site: ' . $m[2]);
>>   error_log('yt id and parms: ' . $m[3]);
>>
>> ... rest not shown.
>>
>>
>> If on my page I have:
>>
>> https://youtu.be/3kx24YtwPKA"4:3"
>>
>> Looking at my debug log messages I see:
>>
>> [31-Oct-2026 17:47:33 America/Chicago] yt site: //youtu.be
>> [31-Oct-2026 17:47:33 America/Chicago] yt id and parms: 3kx24YtwPKA
>>
>> Which I expect.  This is fine.
>>
>> But then if I have:
>>
>> https://youtu.be/euLOyGadyDs&list=PLZOfSznMOwYenRt25XSChMwxxim5bKVOx&index=104
>>
>> I get (notice the 18B19B at the end):
>>
>> [31-Oct-2026 17:52:54 America/Chicago] yt site: //youtu.be
>> [31-Oct-2026 17:52:54 America/Chicago] yt id and parms: 
>> euLOyGadyDs&list=PLZOfSznMOwYenRt25XSChMwxxim5bKVOx&index=10418B19B
>>
>> The difference is the m[4] aspect ratio in quotes is missing, But isn't that 
>> ok here? (zero or one time)  And I'm still not sure what the 18B19B means?
>>
>> I may just be failing regexp school.
>>
>> _______________________________________________
>> pmwiki-users mailing list
>> pmwiki-users at pmichaud.com
>> http://www.pmichaud.com/mailman/listinfo/pmwiki-users
> 




More information about the pmwiki-users mailing list