[Pharo-users] Codepage 437

Sven Van Caekenberghe sven at stfx.eu
Tue Oct 20 08:22:52 EDT 2015


Norbert,

> On 20 Oct 2015, at 14:11, Norbert Hartl <norbert at hartl.name> wrote:
> 
> Is there any way to read a codepage 437 encoded file with pharo?
> 
> thanks,
> 
> Norbert

This could be done with ZnByteEncoder, but that encoding is not provided by default. So you need to generate a new mapping method, luckily this can be done automagically:

ZnByteEncoder generateByteToUnicodeSpec: 'http://www.unicode.org/Public/MAPPINGS/VENDORS/MICSFT/PC/CP437.TXT'.

Put it on the class side and plug it in #mappingToIdentifiers and #initialize again. I guess you maybe could provide a one-shot instance, but I have never done that and adding it as known encoding will be easier at first. 

I am sure you will figure it out ;-)

Let me know how it goes, maybe it would be a good idea to allow one-shot encoder instances based just on a spec from unicode.org

Sven





More information about the Pharo-users mailing list