equal
deleted
inserted
replaced
50 ! ! |
50 ! ! |
51 |
51 |
52 !EncodedStream class methodsFor:'utilities'! |
52 !EncodedStream class methodsFor:'utilities'! |
53 |
53 |
54 decodedStreamFor:aStream |
54 decodedStreamFor:aStream |
|
55 "given a positionable stream, guess its encoding (by reading the |
|
56 first few lines, looking for a string with an encoding hint, |
|
57 and return an appropriate encoded string, which does the decoding |
|
58 on the fly. Used mostly to read UTF8 files (source code)" |
|
59 |
55 |encodingSymbol decoder decodedStream| |
60 |encodingSymbol decoder decodedStream| |
56 |
61 |
57 aStream isPositionable ifTrue:[ |
62 aStream isPositionable ifTrue:[ |
58 encodingSymbol := CharacterEncoder guessEncodingOfStream:aStream. |
63 encodingSymbol := CharacterEncoder guessEncodingOfStream:aStream. |
59 decoder := self encoderFor:encodingSymbol. |
64 decoder := self encoderFor:encodingSymbol. |
329 ! ! |
334 ! ! |
330 |
335 |
331 !EncodedStream class methodsFor:'documentation'! |
336 !EncodedStream class methodsFor:'documentation'! |
332 |
337 |
333 version |
338 version |
334 ^ '$Header: /cvs/stx/stx/libbasic/EncodedStream.st,v 1.27 2013-04-03 16:10:25 cg Exp $' |
339 ^ '$Header: /cvs/stx/stx/libbasic/EncodedStream.st,v 1.28 2013-06-03 10:39:29 cg Exp $' |
335 ! |
340 ! |
336 |
341 |
337 version_CVS |
342 version_CVS |
338 ^ '$Header: /cvs/stx/stx/libbasic/EncodedStream.st,v 1.27 2013-04-03 16:10:25 cg Exp $' |
343 ^ '$Header: /cvs/stx/stx/libbasic/EncodedStream.st,v 1.28 2013-06-03 10:39:29 cg Exp $' |
339 ! |
344 ! |
340 |
345 |
341 version_SVN |
346 version_SVN |
342 ^ '§ Id: EncodedStream.st 10643 2011-06-08 21:53:07Z vranyj1 §' |
347 ^ '$ Id: EncodedStream.st 10643 2011-06-08 21:53:07Z vranyj1 $' |
343 ! ! |
348 ! ! |
344 |
349 |