def unpercent

bolt@1.27.0.0 · src/lsp/proto.bend:266

import bolt@1.27.0.0/src/lsp/proto.bend as Proto
import Base
import bolt@1.27.0.0/src/lsp/frame.bend as Frame

266# a file URI's path: the scheme dropped, the %XX bytes decoded as UTF-8
267def unpercent(cs: List<&2, Char>) -> List<&2, U32>:
268  match cs:
269    case Nil{}:
270      Nil{}
271    case Con{'%', Con{a, Con{b, t}}}:
272      +hi = hex(a)
273      +lo = hex(b)
274      (hi * 16 + lo : U32) <> unpercent(t)
275    case Con{c, t}:
276      Frame.encode.one(Char.to_u32(c), unpercent(t))

Uses (11)

Used by (1)