-
Notifications
You must be signed in to change notification settings - Fork 19
Commit
Move all codecs in Pharo10 to use Zinc
- Loading branch information
There are no files selected for viewing
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 |
---|---|---|
@@ -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 |