Skip to content

Commit

Permalink
Changing default encoding of file read stream + setter/getter
Browse files Browse the repository at this point in the history
  • Loading branch information
anquetil committed Dec 5, 2023
1 parent 94849ca commit 7412e9a
Showing 1 changed file with 22 additions and 2 deletions.
24 changes: 22 additions & 2 deletions src/FAST-Core-Tools/FASTDifferentialValidator.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,8 @@ Class {
#superclass : #Object,
#instVars : [
'skipPaths',
'comparator'
'comparator',
'encoding'
],
#category : #'FAST-Core-Tools-Validator'
}
Expand All @@ -51,11 +52,30 @@ FASTDifferentialValidator >> compare: node1 to: node2 [
self comparator compare: node1 to: node2
]

{ #category : #accessing }
FASTDifferentialValidator >> defaultEncoding [
"other possibilities are 'latin1', 'utf8', ...
see `ZnCharacterEncoder knownEncodingIdentifiers` for all possibilities"
^encoding ifNil: [ 'iso-8859-1' ]
]

{ #category : #accessing }
FASTDifferentialValidator >> encoding [

^encoding
]

{ #category : #accessing }
FASTDifferentialValidator >> encoding: aString [

encoding := aString
]

{ #category : #utilities }
FASTDifferentialValidator >> getASTFromFileReference: aFileReference [

| model |
aFileReference readStreamDo: [ :stream |
aFileReference readStreamEncoded: self defaultEncoding do: [ :stream |
model := self getASTFromString: stream contents ].

^self getTopLevelNodes: model
Expand Down

0 comments on commit 7412e9a

Please sign in to comment.