[squeak-dev] The Trunk: System-nice.541.mcz
commits at source.squeak.org
commits at source.squeak.org
Sun Jun 2 16:47:06 UTC 2013
Nicolas Cellier uploaded a new version of System to project The Trunk:
http://source.squeak.org/trunk/System-nice.541.mcz
==================== Summary ====================
Name: System-nice.541
Author: nice
Time: 2 June 2013, 6:46:07.394 pm
UUID: c37330b6-d436-4f84-880f-8b77f2c970e6
Ancestors: System-fbs.540
Let MczInstaller know that .mcz text files are encoded in utf8.
=============== Diff against System-fbs.540 ===============
Item was added:
+ ----- Method: MczInstaller>>contentsForMember: (in category 'private') -----
+ contentsForMember: member
+ ^[(member contentStreamFromEncoding: 'utf8') text contents] on: InvalidUTF8
+ do: [:exc |
+ "Case of legacy encoding, presumably it is latin-1.
+ But if contents starts with a null character, it might be a case of WideString encoded in UTF-32BE"
+ | str |
+ str := (member contentStreamFromEncoding: 'latin1') text..
+ exc return: ((str peek = Character null and: [ str size \\ 4 = 0 ])
+ ifTrue: [WideString fromByteArray: str contents asByteArray]
+ ifFalse: [str contents])]!
Item was changed:
----- Method: MczInstaller>>installMember: (in category 'installation') -----
installMember: member
self useNewChangeSetDuring:
+ [ | contents |
+ contents := self contentsForMember: member.
+ contents readStream fileInAnnouncing: 'loading ', member fileName.
+ ]!
- [ | str |
- str := member contentStream text readStream contents.
- str := [str utf8ToSqueak] on: InvalidUTF8 do: [:exc |
- "Case of legacy encoding, presumably it is latin-1 and we do not need to do anything
- But if contents starts with a null character, it might be a case of WideString encoded in UTF-32BE"
- exc return: (((str beginsWith: Character null asString) and: [ str size \\ 4 = 0 ])
- ifTrue: [WideString fromByteArray: str asByteArray]
- ifFalse: [str])].
- str readStream fileInAnnouncing: 'loading ', member fileName ]!
Item was changed:
----- Method: MczInstaller>>parseMember: (in category 'utilities') -----
+ parseMember: memberOrName
+ | member contents tokens |
+ member := self zip member: memberOrName.
+ contents := self contentsForMember: member.
+ tokens := (self scanner scanTokens: contents) first.
- parseMember: fileName
- | tokens |
- tokens := (self scanner scanTokens: (zip contentsOf: fileName)) first.
^ self associate: tokens!
More information about the Squeak-dev
mailing list
|