### ----------------------------------------------------
### -- HTML::Component
### -- Licenses: Artistic-2.0
### -- Authors: Fernando Corrêa
### -- File: lib/HTML/Component/Encode.rakumod
### ----------------------------------------------------
sub html-encode($str) is export {
    $str.trans:
        /\&/ => '&amp;',
        /\</ => '&lt;',
        /\>/ => '&gt;',
        /\"/ => '&quot;',
        /\'/ => '&apos;',
        /<[\xA0..\xD8FF \xE000..\xFFFD]>{}/
            => { '&#' ~ $/.ord ~ ';' },
}



