Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
initialize-release
urlAsIri: boolean
"When boolean is true, I encode as an IRI, leaving non-ASCII characters as they are, and accept them when decoding.
Else I percent-encode everything outside my safe set, and reject non-ASCII characters when decoding."

urlAsIri := boolean
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
private
accessing
urlAsIri
^ ZnCurrentOptions at: #urlAsIri
"Return if I encode as an IRI, leaving non-ASCII characters as they are, and accept them when decoding.
ZnUrl and friends set this from the #urlAsIri ZnOptions, which this package cannot see."

^ urlAsIri ifNil: [ urlAsIri := false ]
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@
"instvars" : [
"characterEncoder",
"safeSet",
"decodePlusAsSpace"
"decodePlusAsSpace",
"urlAsIri"
],
"name" : "ZnPercentEncoder",
"type" : "normal"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
*Zinc-Character-Encoding-Core
*Zinc-HTTP
rawStream
"Answer the innermost stream wrapped by the receiver, e.g. a raw binary file stream,
socket stream, or regular Read/WriteStream.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
*Zinc-Character-Encoding-Core
*Zinc-HTTP
wrappedStream
"Answer the stream that the receiver wraps.
Since this the base stream, answer nil"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,5 @@ parseFrom: string
ifFalse: [
ZnPercentEncoder new
characterEncoder: mediaType charSet asZnCharacterEncoder;
urlAsIri: (ZnCurrentOptions at: #urlAsIri);
decode: data ]
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,5 @@ printOn: stream
stream nextPut: $,.
ZnPercentEncoder new
characterEncoder: mediaType charSet asZnCharacterEncoder;
urlAsIri: (ZnCurrentOptions at: #urlAsIri);
encode: data readStream to: stream ]
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,5 @@ converting
decodePercent: string
^ ZnPercentEncoder new
decodePlusAsSpace: false;
urlAsIri: (ZnCurrentOptions at: #urlAsIri);
decode: string
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,5 @@ converting
decodePercentForQuery: string
^ ZnPercentEncoder new
decodePlusAsSpace: true;
urlAsIri: (ZnCurrentOptions at: #urlAsIri);
decode: string
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,5 @@ encodePercent: string safeSet: safeSet encoder: encoder
^ ZnPercentEncoder new
characterEncoder: encoder;
safeSet: (self perform: safeSet);
urlAsIri: (ZnCurrentOptions at: #urlAsIri);
encode: string
Loading