I'm new to scheme and try to build a simple application in scheme. I want to use simple text files as a database, so the program basically load text from a file, do something with it and save the result to a (possibly different) file. My problem is, that the text I'm working with, is in german, so i need the "latin-1-symbols" Ä/ä, Ö/ö, Ü/ü and ß. I am using chez scheme and i read about the transcoders (R6RS), but i can't get it working.
Could someone please give me a simple example, how to get (input-port) and save (output-port) text in latin-1-codec in chez scheme?
Thank you very much.
With the information provided by R6RS, R6RS-lib and the Chez-User-Guide I couldn't solve the problem. On the Internet I couldn't find any further explanation. If someone know a good source for learning material, I would appreciate it.
With strict R6RS, you have to use the 4-argument version of
open-file-input-port
/open-file-output-port
with a transcoder returned by(make-transcoder (latin-1-codec))
to get a textual input port that converts from ISO-8859-1. Unfortunately, there's no version ofcall-with-input-file
,with-input-from-file
, etc. that lets you specify a transcoder, so you have to remember to close the returned port manually. Chez has acurrent-transcoder
parameter that can used to change the default one, allowing you to use those functions, though.Examples for input (The same concepts apply for output):