URL.percent_codepoint_width: def of qasim-bend-kit@0.1.0.2 Import: import qasim-bend-kit@0.1.0.2/libs/URL.bend as URL Lines 16-27 of qasim-bend-kit@0.1.0.2/libs/URL.bend: https://jend.leeeet.dev/read.txt?path=qasim-bend-kit@0.1.0.2/libs/URL.bend&start_line=16&end_line=27 import Base def percent_codepoint_width(+codepoint: U32, width: U32) -> String: match width: case 1: percent_byte(codepoint) case 2: percent_byte((192 + U32.shrn(codepoint, 6n) : U32)) ++ percent_byte((128 + U32.and(codepoint, 63) : U32)) case 3: percent_byte((224 + U32.shrn(codepoint, 12n) : U32)) ++ percent_byte((128 + U32.and(U32.shrn(codepoint, 6n), 63) : U32)) ++ percent_byte((128 + U32.and(codepoint, 63) : U32)) case _: percent_byte((240 + U32.shrn(codepoint, 18n) : U32)) ++ percent_byte((128 + U32.and(U32.shrn(codepoint, 12n), 63) : U32)) ++ percent_byte((128 + U32.and(U32.shrn(codepoint, 6n), 63) : U32)) ++ percent_byte((128 + U32.and(codepoint, 63) : U32)) Uses (10): https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=Bool https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=String https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=String.append https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=U32 https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=U32.add https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=U32.and https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=U32.shrn https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=Word.Con https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=Word.Nil https://jend.leeeet.dev/definition.txt?path=qasim-bend-kit@0.1.0.2/libs/URL.bend&name=percent_byte