From 55b21ce8b1c3605f95c4433670a76ff5bfe13ebc Mon Sep 17 00:00:00 2001 From: Ian Lynagh Date: Sun, 1 Oct 2006 01:07:00 +0000 Subject: [PATCH] Latin-1-to-UTF8 pre-processor example for docs from Christian Maeder --- docs/users_guide/6.6-notes.xml | 5 +++++ docs/users_guide/phases.xml | 18 ++++++++++++++++++ 2 files changed, 23 insertions(+) diff --git a/docs/users_guide/6.6-notes.xml b/docs/users_guide/6.6-notes.xml index 55065dc..31ad813 100644 --- a/docs/users_guide/6.6-notes.xml +++ b/docs/users_guide/6.6-notes.xml @@ -62,6 +62,11 @@ ignored in comments, so ASCII code with comments in, for example, Latin-1 will also work. + + + A way to have Latin-1 source files pre-processed by GHC is + described in . + diff --git a/docs/users_guide/phases.xml b/docs/users_guide/phases.xml index 4066345..9058177 100644 --- a/docs/users_guide/phases.xml +++ b/docs/users_guide/phases.xml @@ -486,6 +486,24 @@ $ cat foo.hspp are fed to cmd on the command line after the three standard input and output arguments. + + + An example of a pre-processor is to convert your source files to the + input encoding that GHC expects, i.e. create a script + convert.sh containing the lines: + + +#!/bin/sh +( echo "{-# LINE 1 \"$2\" #-}" ; iconv -f l1 -t utf-8 $2 ) > $3 + + and pass -F -pgmF convert.sh to GHC. + The -f l1 option tells iconv to convert your + Latin-1 file, supplied in argument $2, while + the "-t utf-8" options tell iconv to return a UTF-8 encoded file. + The result is redirected into argument $3. + The echo "{-# LINE 1 \"$2\" #-}" + just makes sure that your error positions are reported as + in the original source file. -- 1.7.10.4