Skip to content

Commit

Permalink
Merge pull request #137 from SeasideSt/grpackage-pharo100
Browse files Browse the repository at this point in the history
Move all codecs in Pharo10 to use Zinc
  • Loading branch information
Johan Brichau authored Apr 9, 2022
2 parents 1d8daee + 3c4fa03 commit aa57cee
Show file tree
Hide file tree
Showing 58 changed files with 60 additions and 236 deletions.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
private
basicForEncoding: aString
(self supportsEncoding: aString)
ifFalse: [ self unsupportedEncoding: aString ].
^ self basicNew initializeWithName: aString
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
accessing
codecs
^ self supportedEncodingNames
collect: [ :each | self basicForEncoding: each greaseString ]
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
accessing
supportedEncodingNames
"answers the names of the encodings supported by this class"

| all |
all := ZnCharacterEncoder knownEncodingIdentifiers asOrderedCollection.
(all includes: 'utf8')
ifTrue:[ all addAll: #('utf-8' 'UTF-8') ].
(all includes: 'utf16')
ifTrue:[ all addAll: #('utf-16' 'UTF-16') ].
(all includes: 'macroman')
ifTrue:[ all add: 'mac-roman' ].
^ all
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
accessing
supportsEncoding: aName
^ self supportedEncodingNames includes: aName
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
conversion
decoderFor: aStream
^ self encoderFor: aStream
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
conversion
encoderFor: aStream
^ GRPharoZnCodecStream
on: aStream
withEncoder: (ZnCharacterEncoder newForEncoding: self name)
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
initialization
initializeWithName: aString
self initialize.
name := aString.
urlCodec := (#('iso-8859-15' 'cp-1252' 'utf8' 'utf-8' 'UTF-8') includes: aString)
ifFalse: [ GRCodec forEncoding: 'utf8' ]
ifTrue: [ self ]
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
accessing
name
^ 'utf-8'
^ name
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
accessing
url
"RFC 3986: When a new URI scheme defines a component that represents textual data consisting of characters from the Universal Character Set [UCS], the data should first be encoded as octets according to the UTF-8 character encoding."

^ urlCodec
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,10 @@
"classinstvars" : [ ],
"pools" : [ ],
"classvars" : [ ],
"instvars" : [ ],
"name" : "GRPharoUtf16Codec",
"instvars" : [
"name",
"urlCodec"
],
"name" : "GRPharoZnCodec",
"type" : "normal"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
instance creation
on: aStream withEncoder: aZnEncoder
^ self basicNew initializeOn: aStream withEncoder: aZnEncoder
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
initialization
initializeOn: aStream withEncoder: aZnEncoder
self initialize.
stream := aStream.
encoder := aZnEncoder
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,6 @@
"instvars" : [
"encoder"
],
"name" : "GRPharoZnUtf8CodecStream",
"name" : "GRPharoZnCodecStream",
"type" : "normal"
}
Loading

0 comments on commit aa57cee

Please sign in to comment.