Skip to content

Commit

Permalink
fix url encoding + to %20
Browse files Browse the repository at this point in the history
  • Loading branch information
tscherter committed Oct 3, 2023
1 parent bfdfa76 commit ae1046e
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion syntax.php
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ public function handle($match, $state, $pos, Doku_Handler $handler) {
$data['codepoint'] = mb_ord($raw);
} else {
$data['type'] = 'error';
$data['msg'] = mb_strlen($raw);
$data['codepoint'] = -1;
foreach (self::ES as $key => $entry) {
if ($raw==$entry[0]) {
Expand All @@ -84,7 +85,9 @@ public function render($mode, Doku_Renderer $renderer, $data) {

$codepoint = $data['codepoint'];
if ($data['type']=='error' || $codepoint > 0x10FFFFF) {
$renderer->doc .= '<code style="color: red">⚠️ invalid input [' . htmlentities($data['raw']) .']</code>';
if (empty($data['msg'])) $data['msg'] = '-';
$renderer->doc .= '<code style="color: red">⚠️ invalid input ['
. htmlentities($data['raw']) .']: '.$data['msg'].'</code>';
return true;
}

Expand All @@ -100,6 +103,7 @@ public function render($mode, Doku_Renderer $renderer, $data) {
$charname = ' '.self::ES[$codepoint][1];
}
$urlencoding = urlencode($char);
if ($urlencoding=='+') $urlencoding = '%20';

$orange = ' style="color: goldenrod"';
$dred = ' style="color: darkred"';
Expand Down

0 comments on commit ae1046e

Please sign in to comment.