16 lines
562 B
Plaintext
16 lines
562 B
Plaintext
c@(Net URLPathEncoder traits) convert
|
|
[ | byte1 byte2 byte3 digit1 digit2|
|
|
[c in isAtEnd] whileFalse:
|
|
[byte1: c in next.
|
|
byte1 caseOf: {
|
|
$+ -> [c out nextPut: $\s].
|
|
$% -> [byte2: c in next.
|
|
byte3: c in next.
|
|
digit1: (byte2 toDigit: 16).
|
|
digit2: (byte3 toDigit: 16).
|
|
digit1 isNil \/ [digit2 isNil] ifTrue: [error: 'Error reading hex sequence after %'].
|
|
c out nextPut: (digit1 * 16 + digit2 as: c out elementType)].
|
|
} otherwise: [c out nextPut: byte1].
|
|
].
|
|
].
|