CharacterEncoder.st
changeset 18762 4b2d5801f66c
parent 18624 1f113cce940e
child 18768 99079a967eb0
child 19465 83cd3327e4c4
equal deleted inserted replaced
18761:2358ffda3751 18762:4b2d5801f66c
  1215         encoding #name
  1215         encoding #name
  1216      or:
  1216      or:
  1217         encoding: name
  1217         encoding: name
  1218      within the given buffer 
  1218      within the given buffer 
  1219      (which is usually the first few bytes of a textFile).
  1219      (which is usually the first few bytes of a textFile).
  1220      If thats not found, use heuristics (in CharacterArray) to guess."
  1220      If thats not found, use heuristics (in CharacterArray) to guess.
       
  1221      Return a symbol like #utf8."
  1221 
  1222 
  1222     |s buffer n "{Class: SmallInteger }"|
  1223     |s buffer n "{Class: SmallInteger }"|
  1223 
  1224 
  1224     s := aFilename asFilename readStreamOrNil.
  1225     s := aFilename asFilename readStreamOrNil.
  1225     s isNil ifTrue:[^ nil].
  1226     s isNil ifTrue:[^ nil].
  1242 guessEncodingOfStream:aStream
  1243 guessEncodingOfStream:aStream
  1243     "look for a string of the form
  1244     "look for a string of the form
  1244             encoding #name
  1245             encoding #name
  1245      or:
  1246      or:
  1246             encoding: name
  1247             encoding: name
  1247      in the first few bytes of aStream."
  1248      in the first few bytes of aStream.
       
  1249      Return a symbol like #utf8."
  1248 
  1250 
  1249     |oldPosition buffer n|
  1251     |oldPosition buffer n|
  1250 
  1252 
  1251     buffer := String new:64.
  1253     buffer := String new:64.
  1252 
  1254