> On 26 Sep 2017, at 17:25, Stephane Ducasse <[email protected]> wrote:
> 
> Hi sven
> 
> the web site I was using remove the file for my book.
> So I copied the file on github.
> When I open the file with texmate it tells that the encoding is western-latin1
> but when I try to load it as follow I get an UTF-8 illegal error.
> 
> | lines |
> lines := (ZnDefaultCharacterEncoder
>  value: ZnCharacterEncoder latin1
>  during: [
>    ZnClient new
>      get: 
> 'https://raw.githubusercontent.com/SquareBracketAssociates/LearningOOPWithPharo/master/resources/listeDeMotsFrancaisFrGut.txt'
> ]) lines.
> 
> Do you have any idea?
> 
> Tx
> 
> Stef

Any chance you can point me to the original file ?

The file is indeed in Latin1 encoded, but GitHub serves it as UTF-8 (it did not 
change the contents, but the meta data).

The default encoder option only works when the server says nothing, it does not 
override what the server says.

The only way to read it, is by reading it binary (which basically ignores the 
meta data) and then convert it manually:

(ZnCharacterEncoder latin1 decodeBytes: 
  (ZnClient new
        beBinary;
        get: 
'https://raw.githubusercontent.com/SquareBracketAssociates/LearningOOPWithPharo/master/resources/listeDeMotsFrancaisFrGut.txt'))
 lines.

But this is very ugly.

Best convert the original file to UTF-8 before uploading to GitHub.

Sven



Reply via email to