The Trunk: Collections-nice.196.mcz

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

The Trunk: Collections-nice.196.mcz

commits-2
Nicolas Cellier uploaded a new version of Collections to project The Trunk:
http://source.squeak.org/trunk/Collections-nice.196.mcz

==================== Summary ====================

Name: Collections-nice.196
Author: nice
Time: 17 November 2009, 11:14:59 am
UUID: 24d4a90b-3d42-0945-8f92-b25c7b464ff8
Ancestors: Collections-nice.195

Correct bug reported on beginners list
'aa aa éé aa aa' encodeForHTTP

=============== Diff against Collections-nice.195 ===============

Item was changed:
  ----- Method: String>>encodeForHTTPWithTextEncoding:conditionBlock: (in category 'converting') -----
  encodeForHTTPWithTextEncoding: encodingName conditionBlock: conditionBlock
  "change dangerous characters to their %XX form, for use in HTTP transactions"
 
  | httpSafeStream encodedStream cont |
  httpSafeStream := WriteStream on: (String new).
  encodedStream := MultiByteBinaryOrTextStream on: (String new: 6).
  encodedStream converter: (TextConverter newForEncoding: encodingName).
  self do: [:c |
  (conditionBlock value: c)
  ifTrue: [httpSafeStream nextPut: (Character value: c charCode)]
  ifFalse: [
+ encodedStream text; resetToStart.
- encodedStream text; reset.
  encodedStream nextPut: c.
  encodedStream position: 0.
  encodedStream binary.
  cont := encodedStream contents.
  cont do: [:byte |
  httpSafeStream nextPut: $%.
  httpSafeStream nextPut: (byte // 16) asHexDigit.
  httpSafeStream nextPut: (byte \\ 16) asHexDigit.
  ].
  ].
  ].
  ^ httpSafeStream contents.
  !