A new version of Multilingual was added to project The Inbox:
http://source.squeak.org/inbox/Multilingual-ul.206.mcz ==================== Summary ==================== Name: Multilingual-ul.206 Author: ul Time: 15 April 2015, 12:58:54.863 am UUID: 87d8c067-7d51-4aec-b5bc-d439b821e143 Ancestors: Multilingual-topa.205 TextConverter >> #decodeString: and UTF8TextConverter >> #decodeString: does line end conversion as requested. UTF8TextConverter >> #decodeString: takes into account the requested line end conversion. UTF8TextConverter >> #nextChunkFromStream: uses #decodeString:, which does implements line end conversion. =============== Diff against Multilingual-topa.205 =============== Item was changed: ----- Method: MultiByteFileStream>>nextChunk (in category 'fileIn/Out') ----- nextChunk "Answer the contents of the receiver, up to the next terminator character. Doubled terminators indicate an embedded terminator character." + ^converter nextChunkFromStream: self! - ^(wantsLineEndConversion and: [ lineEndConvention notNil ]) - ifTrue: [converter nextChunkLineEndConvertingFromStream: self] - ifFalse: [converter nextChunkFromStream: self]! Item was changed: ----- Method: TextConverter>>decodeString: (in category 'conversion') ----- decodeString: aString + | result | + result := String new: aString size streamContents: [ :stream | - ^String new: aString size streamContents: [ :stream | | readStream character | readStream := aString readStream. [ (character := self nextFromStream: readStream) == nil ] + whileFalse: [ stream nextPut: character ] ]. + self class latin1Encodings == latin1Encodings ifTrue: [ ^result ]. + ^result withSqueakLineEndings! - whileFalse: [ stream nextPut: character ] ] - ! Item was changed: ----- Method: UTF8TextConverter>>decodeString: (in category 'conversion') ----- decodeString: aString + | result | + aString isByteString ifFalse: [ ^super decodeString: aString ]. + result := self class decodeByteString: aString. + self class latin1Encodings == latin1Encodings ifTrue: [ ^result ]. + ^result withSqueakLineEndings! - aString isByteString ifTrue: [ ^self class decodeByteString: aString ]. - ^super decodeString: aString! Item was changed: ----- Method: UTF8TextConverter>>encodeString: (in category 'conversion') ----- encodeString: aString + | result | + aString isByteString ifFalse: [ ^super encodeString: aString ]. + result := self class encodeByteString: aString. + self class latin1Encodings == latin1Encodings ifTrue: [ ^result ]. + ^result withLineEndings: (latin1Encodings at: 14) + ! - aString isByteString ifTrue: [ ^self class encodeByteString: aString ]. - ^super encodeString: aString! Item was changed: ----- Method: UTF8TextConverter>>nextChunkFromStream: (in category 'fileIn/Out') ----- nextChunkFromStream: input "Answer the contents of input, up to the next terminator character. Doubled terminators indicate an embedded terminator character." self skipSeparatorsFrom: input. ^self parseLangTagFor: ( + self decodeString: ( - self class decodeByteString: ( String new: 1000 streamContents: [ :stream | [ stream nextPutAll: (input basicUpTo: $!!). input basicNext == $!! ] whileTrue: [ stream nextPut: $!! ]. input atEnd ifFalse: [ input skip: -1 ] ])) fromStream: input! Item was removed: - ----- Method: UTF8TextConverter>>nextChunkLineEndConvertingFromStream: (in category 'fileIn/Out') ----- - nextChunkLineEndConvertingFromStream: input - "Answer the contents of input, up to the next terminator character. Doubled terminators indicate an embedded terminator character." - "Obey line end conversion." - - self skipSeparatorsFrom: input. - ^self - parseLangTagFor: ( - self class decodeByteString: ( - String new: 1000 streamContents: [ :stream | - [ - stream nextPutAll: (input upTo: $!!). - input basicNext == $!! ] - whileTrue: [ - stream nextPut: $!! ]. - input atEnd ifFalse: [ input skip: -1 ] ])) - fromStream: input! |
Free forum by Nabble | Edit this page |